diff --git a/pageant.c b/pageant.c index ada2853f..819e5c9d 100644 --- a/pageant.c +++ b/pageant.c @@ -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)) { diff --git a/testsc.c b/testsc.c index ab60d9ab..f26a42ba 100644 --- a/testsc.c +++ b/testsc.c @@ -658,6 +658,7 @@ static void test_mp_modsqrt(void) } mp_free(x); + modsqrt_free(sc); } static WeierstrassCurve *wcurve(void) diff --git a/unix/uxcons.c b/unix/uxcons.c index 8e2a9085..3780c896 100644 --- a/unix/uxcons.c +++ b/unix/uxcons.c @@ -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)); } diff --git a/unix/uxpgnt.c b/unix/uxpgnt.c index 389853f8..d029ccb4 100644 --- a/unix/uxpgnt.c +++ b/unix/uxpgnt.c @@ -990,6 +990,7 @@ void run_agent(void) } conf_free(conf); + pollwrap_free(pw); } int main(int argc, char **argv) diff --git a/unix/uxserver.c b/unix/uxserver.c index 1860ece2..e6875edd 100644 --- a/unix/uxserver.c +++ b/unix/uxserver.c @@ -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; diff --git a/unix/uxsftp.c b/unix/uxsftp.c index caf705e9..9b9592ea 100644 --- a/unix/uxsftp.c +++ b/unix/uxsftp.c @@ -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);