mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-12-09 15:41:10 +03:00
options: Fix possible memory leaks on error conditions when setting keys for bind
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
committed by
Andreas Schneider
parent
7eefbbd478
commit
961c79637c
@@ -2285,6 +2285,9 @@ ssh_bind_options_set(ssh_bind sshbind,
|
||||
SSH_FATAL,
|
||||
"The host key size %d is too small.",
|
||||
ssh_key_size(key));
|
||||
if (type != SSH_BIND_OPTIONS_IMPORT_KEY) {
|
||||
SSH_KEY_FREE(key);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
key_type = ssh_key_type(key);
|
||||
@@ -2330,6 +2333,11 @@ ssh_bind_options_set(ssh_bind sshbind,
|
||||
ssh_key_free(key);
|
||||
return -1;
|
||||
}
|
||||
} else if (type == SSH_BIND_OPTIONS_IMPORT_KEY_STR) {
|
||||
if (bind_key_loc == NULL) {
|
||||
ssh_key_free(key);
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
if (bind_key_loc == NULL) {
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user