mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-09 09:54:25 +09:00
Fixed a memory leak in ssh_try_publickey_from_file.
This commit is contained in:
@@ -1086,6 +1086,7 @@ int ssh_try_publickey_from_file(ssh_session session, const char *keyfile,
|
|||||||
if (!ssh_file_readaccess_ok(pubkey_file)) {
|
if (!ssh_file_readaccess_ok(pubkey_file)) {
|
||||||
ssh_log(session, SSH_LOG_PACKET, "Failed to open publickey %s",
|
ssh_log(session, SSH_LOG_PACKET, "Failed to open publickey %s",
|
||||||
pubkey_file);
|
pubkey_file);
|
||||||
|
SAFE_FREE(pubkey_file);
|
||||||
return 1;
|
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",
|
"Wasn't able to open public key file %s: %s",
|
||||||
pubkey_file,
|
pubkey_file,
|
||||||
ssh_get_error(session));
|
ssh_get_error(session));
|
||||||
|
SAFE_FREE(pubkey_file);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SAFE_FREE(pubkey_file);
|
||||||
|
|
||||||
*publickey = pubkey_string;
|
*publickey = pubkey_string;
|
||||||
*type = pubkey_type;
|
*type = pubkey_type;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user