summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2005-11-05 05:01:16 +0000
committerDamien Miller <djm@cvs.openbsd.org>2005-11-05 05:01:16 +0000
commit608ce3811f67ca5a304eb0f27d76fdf942b0c8e1 (patch)
treeae846ad94a9971f5437e16cf08909ac8a3e5979c
parentf6f80f43092a224e421cb753dbaae6ee02d44232 (diff)
Fix leaks in error paths, bz #1109 and #1110 reported by kremenek AT
cs.stanford.edu; ok dtucker@
-rw-r--r--usr.bin/ssh/bufaux.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/usr.bin/ssh/bufaux.c b/usr.bin/ssh/bufaux.c
index 8d096a05638..106a3a0c70a 100644
--- a/usr.bin/ssh/bufaux.c
+++ b/usr.bin/ssh/bufaux.c
@@ -37,7 +37,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: bufaux.c,v 1.36 2005/06/17 02:44:32 djm Exp $");
+RCSID("$OpenBSD: bufaux.c,v 1.37 2005/11/05 05:01:15 djm Exp $");
#include <openssl/bn.h>
#include "bufaux.h"
@@ -63,6 +63,7 @@ buffer_put_bignum_ret(Buffer *buffer, const BIGNUM *value)
if (oi != bin_size) {
error("buffer_put_bignum_ret: BN_bn2bin() failed: oi %d != bin_size %d",
oi, bin_size);
+ xfree(buf);
return (-1);
}
@@ -187,10 +188,12 @@ buffer_get_bignum2_ret(Buffer *buffer, BIGNUM *value)
if (len > 0 && (bin[0] & 0x80)) {
error("buffer_get_bignum2_ret: negative numbers not supported");
+ xfree(bin);
return (-1);
}
if (len > 8 * 1024) {
error("buffer_get_bignum2_ret: cannot handle BN of size %d", len);
+ xfree(bin);
return (-1);
}
BN_bin2bn(bin, len, value);