mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-03-24 20:40:09 +09:00
knownhosts: Avoid possible memory leak on failed malloc
Thanks oss-fuzz https://issues.oss-fuzz.com/issues/489362256 Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Eshan Kelkar <eshankelkar@galorithm.com>
This commit is contained in:
@@ -310,7 +310,11 @@ static int ssh_known_hosts_read_entries(const char *match,
|
||||
}
|
||||
}
|
||||
if (entry != NULL) {
|
||||
ssh_list_append(*entries, entry);
|
||||
rc = ssh_list_append(*entries, entry);
|
||||
if (rc != SSH_OK) {
|
||||
ssh_knownhosts_entry_free(entry);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user