зеркало из https://github.com/github/putty.git
Fix assorted minor memory leaks.
All found by Coverity.
This commit is contained in:
Родитель
08f1e2a506
Коммит
44adc8be1b
4
config.c
4
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) {
|
||||
|
|
4
import.c
4
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];
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
4
sshdss.c
4
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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 */
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче