summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/monitor.c
diff options
context:
space:
mode:
authormarkus <markus@openbsd.org>2003-03-05 22:33:43 +0000
committermarkus <markus@openbsd.org>2003-03-05 22:33:43 +0000
commitce850b032b66ce5ec1fcf20b26e03ac295ba3db5 (patch)
tree299a43373b41c270a5c1399d2a1942948eed2ae7 /usr.bin/ssh/monitor.c
parentdelete blank lines (diff)
downloadwireguard-openbsd-ce850b032b66ce5ec1fcf20b26e03ac295ba3db5.tar.xz
wireguard-openbsd-ce850b032b66ce5ec1fcf20b26e03ac295ba3db5.zip
fix memory leaks; from dlheine@suif.Stanford.EDU/CLOUSEAU; ok djm@
Diffstat (limited to 'usr.bin/ssh/monitor.c')
-rw-r--r--usr.bin/ssh/monitor.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/usr.bin/ssh/monitor.c b/usr.bin/ssh/monitor.c
index 50e6a948b8e..aec950e3b74 100644
--- a/usr.bin/ssh/monitor.c
+++ b/usr.bin/ssh/monitor.c
@@ -25,7 +25,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: monitor.c,v 1.32 2003/02/16 17:30:33 markus Exp $");
+RCSID("$OpenBSD: monitor.c,v 1.33 2003/03/05 22:33:43 markus Exp $");
#include <openssl/dh.h>
@@ -771,8 +771,9 @@ mm_answer_keyallowed(int socket, Buffer *m)
fatal("%s: unknown key type %d", __func__, type);
break;
}
- key_free(key);
}
+ if (key != NULL)
+ key_free(key);
/* clear temporarily storage (used by verify) */
monitor_reset_key_state();
@@ -1169,8 +1170,9 @@ mm_answer_rsa_keyallowed(int socket, Buffer *m)
key_blob = blob;
key_bloblen = blen;
key_blobtype = MM_RSAUSERKEY;
- key_free(key);
}
+ if (key != NULL)
+ key_free(key);
mm_append_debug(m);
@@ -1211,6 +1213,9 @@ mm_answer_rsa_challenge(int socket, Buffer *m)
mm_request_send(socket, MONITOR_ANS_RSACHALLENGE, m);
monitor_permit(mon_dispatch, MONITOR_REQ_RSARESPONSE, 1);
+
+ xfree(blob);
+ key_free(key);
return (0);
}
@@ -1241,6 +1246,7 @@ mm_answer_rsa_response(int socket, Buffer *m)
fatal("%s: received bad response to challenge", __func__);
success = auth_rsa_verify_response(key, ssh1_challenge, response);
+ xfree(blob);
key_free(key);
xfree(response);