diff options
author | 2013-06-05 12:52:38 +0000 | |
---|---|---|
committer | 2013-06-05 12:52:38 +0000 | |
commit | 4d270f5133256bb7eb3c8eb9acf8ab4570585f8e (patch) | |
tree | 3d509f1342c195075dea3b971ff5e2cafb2f1289 /usr.bin/ssh/sshconnect2.c | |
parent | on drugs, did not read pedro's patch and just zapped the comment. (diff) | |
download | wireguard-openbsd-4d270f5133256bb7eb3c8eb9acf8ab4570585f8e.tar.xz wireguard-openbsd-4d270f5133256bb7eb3c8eb9acf8ab4570585f8e.zip |
Fix memory leaks found by Zhenbo Xu and the Melton tool. bz#1967, ok djm
Diffstat (limited to 'usr.bin/ssh/sshconnect2.c')
-rw-r--r-- | usr.bin/ssh/sshconnect2.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/ssh/sshconnect2.c b/usr.bin/ssh/sshconnect2.c index 30e878f06cc..a5e621ea81b 100644 --- a/usr.bin/ssh/sshconnect2.c +++ b/usr.bin/ssh/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. @@ -1316,8 +1316,11 @@ load_identity_file(char *filename, int userprovided) 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; @@ -1909,6 +1912,7 @@ authmethod_get(char *authlist) free(name); return current; } + free(name); } } |