summaryrefslogtreecommitdiffstats
path: root/libssh/keyfiles.c
diff options
context:
space:
mode:
Diffstat (limited to 'libssh/keyfiles.c')
-rw-r--r--libssh/keyfiles.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libssh/keyfiles.c b/libssh/keyfiles.c
index 8646937..21b02a8 100644
--- a/libssh/keyfiles.c
+++ b/libssh/keyfiles.c
@@ -669,6 +669,7 @@ ssh_private_key privatekey_from_file(ssh_session session, const char *filename,
if (type == 0) {
type = privatekey_type_from_file(file);
if (type == 0) {
+ fclose(file);
ssh_set_error(session, SSH_FATAL, "Invalid private key file.");
return NULL;
}
@@ -755,6 +756,7 @@ ssh_private_key privatekey_from_file(ssh_session session, const char *filename,
}
break;
default:
+ fclose(file);
ssh_set_error(session, SSH_FATAL, "Invalid private key type %d", type);
return NULL;
} /* switch */