summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2009-11-11 13:23:02 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2009-11-11 13:23:02 +0000
commit774e9a7c588aab9b75b8501568a7aa7ec82f3735 (patch)
tree824945d2a893e1f27a214db979af91279b69b480 /usr.sbin
parent973d6aa2c036359ce6864b38454f48e2f42250e0 (diff)
Don't leak memory in error case.
Found by parfait.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/tcpdump/print-ipsec.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/tcpdump/print-ipsec.c b/usr.sbin/tcpdump/print-ipsec.c
index dd6204a3c88..5e332fd5658 100644
--- a/usr.sbin/tcpdump/print-ipsec.c
+++ b/usr.sbin/tcpdump/print-ipsec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: print-ipsec.c,v 1.14 2009/10/27 23:59:55 deraadt Exp $ */
+/* $OpenBSD: print-ipsec.c,v 1.15 2009/11/11 13:23:01 jsg Exp $ */
/*
* Copyright (c) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999
@@ -104,8 +104,10 @@ esp_init (char *espspec)
s[0] = espkey[2*i];
s[1] = espkey[2*i + 1];
s[2] = 0;
- if (!isxdigit(s[0]) || !isxdigit(s[1]))
+ if (!isxdigit(s[0]) || !isxdigit(s[1])) {
+ free(key);
error("espkey must be specified in hex");
+ }
key[i] = strtoul(s, NULL, 16);
}
EVP_CIPHER_CTX_init(&ctx);