Skip to content
Snippets Groups Projects
Commit 842bd481 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Fix obvious errors found by Coverity.

A couple were actually serious, most were unimportant.
parent 2dd514d0
No related branches found
No related tags found
No related merge requests found
Pipeline #5814 passed
......@@ -695,9 +695,7 @@ int curs_vmem_gettext(int sx, int sy, int ex, int ey, struct vmem_cell *fill)
fill[fillpos].ch=(unsigned char)(thischar);
attrib=0;
if (attr & WA_BOLD) {
if (thischar == ' ')
thischar = 0;
else
if (thischar != ' ')
attrib |= 8;
}
if (attr & WA_BLINK)
......
......@@ -69,7 +69,7 @@ cryptlib_error_message(int status, const char *msg)
{
char str[64];
char str2[64];
char *errmsg;
char *errmsg = NULL;
int err_len;
bool err_written = false;
......@@ -86,8 +86,8 @@ cryptlib_error_message(int status, const char *msg)
sprintf(str2, "Error %d %s", status, msg);
uifcmsg(str2, errmsg);
err_written = true;
free(errmsg);
}
free(errmsg);
}
}
if (!err_written) {
......@@ -249,7 +249,7 @@ ssh_input_thread(void *args)
if (chan == -1) {
if (sftp_channel != -1) {
FlushData(ssh_session);
status = cryptSetAttribute(ssh_session, CRYPT_SESSINFO_SSH_CHANNEL, ssh_channel);
status = cryptSetAttribute(ssh_session, CRYPT_SESSINFO_SSH_CHANNEL, sftp_channel);
if (status == CRYPT_ERROR_NOTFOUND) {
chan = sftp_channel;
}
......@@ -259,7 +259,7 @@ ssh_input_thread(void *args)
}
if (cryptStatusError(popstatus)) {
if (chan == -1 || (popstatus == CRYPT_ERROR_COMPLETE) || (popstatus == CRYPT_ERROR_READ)) { /* connection closed */
if (chan == -1) { /* connection closed */
pthread_mutex_lock(&ssh_mutex);
status = cryptSetAttribute(ssh_session, CRYPT_SESSINFO_SSH_CHANNEL, chan);
if (status != CRYPT_ERROR_NOTFOUND) {
......@@ -316,6 +316,9 @@ ssh_input_thread(void *args)
}
}
}
else {
pthread_mutex_unlock(&ssh_mutex);
}
}
FlushData(ssh_session);
}
......@@ -524,14 +527,17 @@ add_public_key(void *vpriv)
status = cryptSetAttribute(ssh_session, CRYPT_SESSINFO_SSH_CHANNEL, ssh_channel);
if (cryptStatusOK(status))
status = cryptGetAttribute(ssh_session, CRYPT_SESSINFO_SSH_CHANNEL_ACTIVE, &active);
if (cryptStatusOK(status) && active) {
pthread_mutex_unlock(&ssh_mutex);
break;
}
}
pthread_mutex_unlock(&ssh_mutex);
if (cryptStatusOK(status) && active)
break;
SLEEP(10);
};
if (!active) {
pubkey_thread_running = false;
free(priv);
return;
}
pthread_mutex_lock(&ssh_tx_mutex);
......@@ -657,6 +663,7 @@ add_public_key(void *vpriv)
}
else {
pthread_mutex_unlock(&ssh_mutex);
pthread_mutex_unlock(&ssh_tx_mutex);
}
free(priv);
pubkey_thread_running = false;
......@@ -1000,6 +1007,9 @@ ssh_connect(struct bbslist *bbs)
pubkey_thread_running = true;
_beginthread(add_public_key, 0, pubkey);
}
else {
free(pubkey);
}
if (!bbs->hidepopups)
uifc.pop(NULL); // TODO: Why is this called twice?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment