diff options
author | Darren Tucker <dtucker@cvs.openbsd.org> | 2013-06-05 12:52:39 +0000 |
---|---|---|
committer | Darren Tucker <dtucker@cvs.openbsd.org> | 2013-06-05 12:52:39 +0000 |
commit | 03199e158b331669d607fea162f623d65a3f58de (patch) | |
tree | 281f5c06a690af235c39c8671464eb152ee3c39b /usr.bin/ssh | |
parent | 76af6cb2c7ce5632a67645b670dcfee2652e1f72 (diff) |
Fix memory leaks found by Zhenbo Xu and the Melton tool. bz#1967, ok djm
Diffstat (limited to 'usr.bin/ssh')
-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); } } |