aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2018-06-05 10:30:56 +0200
committerAndreas Schneider <asn@cryptomilk.org>2018-06-05 10:34:49 +0200
commit1001cbbb99984bb539979fdc7059d7923adae74d (patch)
tree1e1b977b69a8096630c3810b07b7f571732ee4d4
parent36d52ee205512140d1d7dad6e990c925fe153837 (diff)
downloadlibssh-1001cbbb99984bb539979fdc7059d7923adae74d.tar.gz
libssh-1001cbbb99984bb539979fdc7059d7923adae74d.tar.xz
libssh-1001cbbb99984bb539979fdc7059d7923adae74d.zip
knownhosts: Fix resource leak in ssh_known_hosts_read_entries()
CID 1391449 Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--src/knownhosts.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/knownhosts.c b/src/knownhosts.c
index 6cb14989..3e16b7f5 100644
--- a/src/knownhosts.c
+++ b/src/knownhosts.c
@@ -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;
}