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:
Andreas Schneider
2018-06-05 10:30:56 +02:00
parent 36d52ee205
commit 1001cbbb99

View File

@@ -190,6 +190,7 @@ static int ssh_known_hosts_read_entries(const char *match,
entry_list = ssh_list_new();
if (entry_list == NULL) {
fclose(fp);
return SSH_ERROR;
}
@@ -225,9 +226,11 @@ static int ssh_known_hosts_read_entries(const char *match,
*entries = entry_list;
fclose(fp);
return SSH_OK;
error:
ssh_list_free(entry_list);
fclose(fp);
return SSH_ERROR;
}