diff --git a/config.c b/config.c index 16808bcb..4a7426cf 100644 --- a/config.c +++ b/config.c @@ -1429,7 +1429,7 @@ static void clipboard_selector_handler(union control *ctrl, dlgparam *dlg, #endif ) { #ifdef NAMED_CLIPBOARDS - const char *sval = dlg_editbox_get(ctrl, dlg); + char *sval = dlg_editbox_get(ctrl, dlg); int i; for (i = 0; i < lenof(options); i++) @@ -1444,6 +1444,8 @@ static void clipboard_selector_handler(union control *ctrl, dlgparam *dlg, sval++; conf_set_str(conf, strsetting, sval); } + + sfree(sval); #else int index = dlg_listbox_index(ctrl, dlg); if (index >= 0) { diff --git a/import.c b/import.c index effc65be..e6549f1b 100644 --- a/import.c +++ b/import.c @@ -538,8 +538,10 @@ static ssh2_userkey *openssh_pem_read( strbuf *blob = strbuf_new_nm(); int privptr = 0, publen; - if (!key) + if (!key) { + strbuf_free(blob); return NULL; + } if (key->encrypted) { unsigned char keybuf[32]; diff --git a/pageant.c b/pageant.c index 6ade4ccb..d758e02d 100644 --- a/pageant.c +++ b/pageant.c @@ -1290,6 +1290,9 @@ int pageant_add_keyfile(Filename *filename, const char *passphrase, if (resplen < 5 || response[4] != SSH_AGENT_SUCCESS) { *retstr = dupstr("The already running Pageant " "refused to add the key."); + sfree(skey->comment); + ssh_key_free(skey->key); + sfree(skey); sfree(response); return PAGEANT_ACTION_FAILURE; } diff --git a/sesschan.c b/sesschan.c index f9ea1418..a2bb5dfe 100644 --- a/sesschan.c +++ b/sesschan.c @@ -640,10 +640,10 @@ static void sesschan_notify_remote_exit(Seat *seat) sshfwd_send_exit_signal( sess->c, signame, false, ptrlen_from_asciz(sigmsg)); - sfree(sigmsg); - got_signal = true; } + + sfree(sigmsg); } else { int signum = pty_backend_exit_signum(sess->backend); diff --git a/sshdss.c b/sshdss.c index 2bf26d9a..90dc075a 100644 --- a/sshdss.c +++ b/sshdss.c @@ -72,8 +72,10 @@ static char *dss_cache_str(ssh_key *key) struct dss_key *dss = container_of(key, struct dss_key, sshk); strbuf *sb = strbuf_new(); - if (!dss->p) + if (!dss->p) { + strbuf_free(sb); return NULL; + } append_hex_to_strbuf(sb, dss->p); append_hex_to_strbuf(sb, dss->q); diff --git a/unix/uxagentsock.c b/unix/uxagentsock.c index 3fbbb84f..ba87cd1a 100644 --- a/unix/uxagentsock.c +++ b/unix/uxagentsock.c @@ -29,6 +29,7 @@ Socket *platform_make_agent_socket( if ((errw = make_dir_and_check_ours(socketdir)) != NULL) { *error = dupprintf("%s: %s\n", socketdir, errw); sfree(errw); + sfree(socketdir); return NULL; } diff --git a/unix/uxsftp.c b/unix/uxsftp.c index 3195f902..0f1a98b5 100644 --- a/unix/uxsftp.c +++ b/unix/uxsftp.c @@ -490,6 +490,7 @@ static int ssh_sftp_do_select(bool include_stdin, bool no_fds_ok) if (i < 1 && !no_fds_ok && !toplevel_callback_pending()) { pollwrap_free(pw); + sfree(fdlist); return -1; /* doom */ }