mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 09:27:59 +00:00
Fix miscellaneous minor memory leaks.
All found by Coverity.
This commit is contained in:
parent
e82ba498ff
commit
64fdc85b2d
@ -1213,6 +1213,8 @@ int pageant_add_keyfile(Filename *filename, const char *passphrase,
|
||||
*/
|
||||
*retstr = dupstr(error);
|
||||
sfree(rkey);
|
||||
if (comment)
|
||||
sfree(comment);
|
||||
return PAGEANT_ACTION_FAILURE;
|
||||
} else if (ret == 1) {
|
||||
/*
|
||||
@ -1309,6 +1311,8 @@ int pageant_add_keyfile(Filename *filename, const char *passphrase,
|
||||
return PAGEANT_ACTION_FAILURE;
|
||||
}
|
||||
|
||||
ssh_key_free(skey->key);
|
||||
sfree(skey);
|
||||
sfree(response);
|
||||
} else {
|
||||
if (!pageant_add_ssh2_key(skey)) {
|
||||
|
1
testsc.c
1
testsc.c
@ -658,6 +658,7 @@ static void test_mp_modsqrt(void)
|
||||
}
|
||||
|
||||
mp_free(x);
|
||||
modsqrt_free(sc);
|
||||
}
|
||||
|
||||
static WeierstrassCurve *wcurve(void)
|
||||
|
@ -142,8 +142,10 @@ static int block_and_read(int fd, void *buf, size_t len)
|
||||
ret = pollwrap_poll_endless(pw);
|
||||
} while (ret < 0 && errno == EINTR);
|
||||
assert(ret != 0);
|
||||
if (ret < 0)
|
||||
if (ret < 0) {
|
||||
pollwrap_free(pw);
|
||||
return ret;
|
||||
}
|
||||
assert(pollwrap_check_fd_rwx(pw, fd, SELECT_R));
|
||||
}
|
||||
|
||||
|
@ -990,6 +990,7 @@ void run_agent(void)
|
||||
}
|
||||
|
||||
conf_free(conf);
|
||||
pollwrap_free(pw);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
|
@ -235,10 +235,11 @@ RSAKey *auth_publickey_ssh1(
|
||||
}
|
||||
AuthKbdInt *auth_kbdint_prompts(AuthPolicy *ap, ptrlen username)
|
||||
{
|
||||
AuthKbdInt *aki = snew(AuthKbdInt);
|
||||
AuthKbdInt *aki;
|
||||
|
||||
switch (ap->kbdint_state) {
|
||||
case 0:
|
||||
aki = snew(AuthKbdInt);
|
||||
aki->title = dupstr("Initial double prompt");
|
||||
aki->instruction =
|
||||
dupstr("First prompt should echo, second should not");
|
||||
@ -250,6 +251,7 @@ AuthKbdInt *auth_kbdint_prompts(AuthPolicy *ap, ptrlen username)
|
||||
aki->prompts[1].echo = false;
|
||||
return aki;
|
||||
case 1:
|
||||
aki = snew(AuthKbdInt);
|
||||
aki->title = dupstr("Zero-prompt step");
|
||||
aki->instruction = dupstr("Shouldn't see any prompts this time");
|
||||
aki->nprompts = 0;
|
||||
|
@ -488,8 +488,10 @@ static int ssh_sftp_do_select(bool include_stdin, bool no_fds_ok)
|
||||
for (fd = first_fd(&fdstate, &rwx); fd >= 0;
|
||||
fd = next_fd(&fdstate, &rwx)) i++;
|
||||
|
||||
if (i < 1 && !no_fds_ok && !toplevel_callback_pending())
|
||||
if (i < 1 && !no_fds_ok && !toplevel_callback_pending()) {
|
||||
pollwrap_free(pw);
|
||||
return -1; /* doom */
|
||||
}
|
||||
|
||||
/* Expand the fdlist buffer if necessary. */
|
||||
sgrowarray(fdlist, fdsize, i);
|
||||
|
Loading…
Reference in New Issue
Block a user