From eb19a35a3d52dedb5d8c43d74d33c5e10903b2e7 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Mon, 22 Jul 2013 19:55:55 +0000 Subject: [PATCH] Fix a few more memory and resource leaks. [originally from svn r9968] --- proxy.c | 1 + psftp.c | 3 +++ windows/winpgen.c | 7 +++++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/proxy.c b/proxy.c index 70da38c3..13a50715 100644 --- a/proxy.c +++ b/proxy.c @@ -474,6 +474,7 @@ Socket new_connection(SockAddr addr, char *hostname, if (sk_addr_error(proxy_addr) != NULL) { ret->error = "Proxy error: Unable to resolve proxy host name"; sfree(pplug); + sk_addr_free(proxy_addr); return (Socket)ret; } sfree(proxy_canonical_name); diff --git a/psftp.c b/psftp.c index 6dd733d9..8ed2343a 100644 --- a/psftp.c +++ b/psftp.c @@ -1258,7 +1258,9 @@ int sftp_general_get(struct sftp_command *cmd, int restart, int multiple) fname = canonify(origwfname); if (!fname) { + sftp_finish_wildcard_matching(swcm); printf("%s: canonify: %s\n", origwfname, fxp_error()); + sfree(origwfname); sfree(unwcfname); return 0; } @@ -2720,6 +2722,7 @@ static int psftp_connect(char *userhost, char *user, int portnumber) /* Use `host' as a bare hostname. */ conf_set_str(conf, CONF_host, host); } + conf_free(conf2); } else { /* Patch in hostname `host' to session details. */ conf_set_str(conf, CONF_host, host); diff --git a/windows/winpgen.c b/windows/winpgen.c index 9fa35af0..33d76c64 100644 --- a/windows/winpgen.c +++ b/windows/winpgen.c @@ -954,8 +954,11 @@ static int CALLBACK MainDlgProc(HWND hwnd, UINT msg, /* * Load a key file if one was provided on the command line. */ - if (cmdline_keyfile) - load_key_file(hwnd, state, filename_from_str(cmdline_keyfile), 0); + if (cmdline_keyfile) { + Filename *fn = filename_from_str(cmdline_keyfile); + load_key_file(hwnd, state, fn, 0); + filename_free(fn); + } return 1; case WM_MOUSEMOVE: