- dtucker@cvs.openbsd.org 2013/06/05 12:52:38
[sshconnect2.c]
Fix memory leaks found by Zhenbo Xu and the Melton tool. bz#1967, ok djm
diff --git a/sshconnect2.c b/sshconnect2.c
index 19ed345..70e3cd8 100644
--- a/sshconnect2.c
+++ b/sshconnect2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshconnect2.c,v 1.197 2013/05/17 00:13:14 djm Exp $ */
+/* $OpenBSD: sshconnect2.c,v 1.198 2013/06/05 12:52:38 dtucker Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
* Copyright (c) 2008 Damien Miller. All rights reserved.
@@ -1322,8 +1322,11 @@
return NULL;
}
private = key_load_private_type(KEY_UNSPEC, filename, "", NULL, &perm_ok);
- if (!perm_ok)
+ if (!perm_ok) {
+ if (private != NULL)
+ key_free(private);
return NULL;
+ }
if (private == NULL) {
if (options.batch_mode)
return NULL;
@@ -1915,6 +1918,7 @@
free(name);
return current;
}
+ free(name);
}
}