From 38fda265e8974a4af877de4ec5fc5d90187b7023 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Sat, 13 Mar 2010 14:59:02 +0100 Subject: Fixed a memory leak in ssh_try_publickey_from_file. --- libssh/keyfiles.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libssh/keyfiles.c b/libssh/keyfiles.c index 40c6030..70abbe1 100644 --- a/libssh/keyfiles.c +++ b/libssh/keyfiles.c @@ -1086,6 +1086,7 @@ int ssh_try_publickey_from_file(ssh_session session, const char *keyfile, if (!ssh_file_readaccess_ok(pubkey_file)) { ssh_log(session, SSH_LOG_PACKET, "Failed to open publickey %s", pubkey_file); + SAFE_FREE(pubkey_file); return 1; } @@ -1101,9 +1102,12 @@ int ssh_try_publickey_from_file(ssh_session session, const char *keyfile, "Wasn't able to open public key file %s: %s", pubkey_file, ssh_get_error(session)); + SAFE_FREE(pubkey_file); return -1; } + SAFE_FREE(pubkey_file); + *publickey = pubkey_string; *type = pubkey_type; -- cgit