diff options
author | Andreas Schneider <mail@cynapses.org> | 2010-03-13 14:59:02 +0100 |
---|---|---|
committer | Andreas Schneider <mail@cynapses.org> | 2010-03-13 15:00:19 +0100 |
commit | ed1cba705c92ed648e0427ad0a99efeac3228ecc (patch) | |
tree | de7d07fe7789bafb7289d16f59cd05dd052f4f12 | |
parent | 0b13a6d2654bf4cf8d096b54841d495771660692 (diff) | |
download | libssh-ed1cba705c92ed648e0427ad0a99efeac3228ecc.tar.gz libssh-ed1cba705c92ed648e0427ad0a99efeac3228ecc.tar.xz libssh-ed1cba705c92ed648e0427ad0a99efeac3228ecc.zip |
Fixed a memory leak in ssh_try_publickey_from_file.
-rw-r--r-- | libssh/keyfiles.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libssh/keyfiles.c b/libssh/keyfiles.c index e5699765..af6fee13 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; |