mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 18:50:28 +09:00
knownhosts: Fix resource leak in ssh_known_hosts_read_entries()
CID 1391449 Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
@@ -190,6 +190,7 @@ static int ssh_known_hosts_read_entries(const char *match,
|
|||||||
|
|
||||||
entry_list = ssh_list_new();
|
entry_list = ssh_list_new();
|
||||||
if (entry_list == NULL) {
|
if (entry_list == NULL) {
|
||||||
|
fclose(fp);
|
||||||
return SSH_ERROR;
|
return SSH_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,9 +226,11 @@ static int ssh_known_hosts_read_entries(const char *match,
|
|||||||
|
|
||||||
*entries = entry_list;
|
*entries = entry_list;
|
||||||
|
|
||||||
|
fclose(fp);
|
||||||
return SSH_OK;
|
return SSH_OK;
|
||||||
error:
|
error:
|
||||||
ssh_list_free(entry_list);
|
ssh_list_free(entry_list);
|
||||||
|
fclose(fp);
|
||||||
return SSH_ERROR;
|
return SSH_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user