summaryrefslogtreecommitdiff
path: root/lib/libcrypto/x509/x509_v3.c
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2014-09-28 10:53:58 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2014-09-28 10:53:58 +0000
commit6c350f7010fa468164de07d58777f934a2a63a94 (patch)
treeb6085eb594096669d7cf7ca92db4e59d41326f3a /lib/libcrypto/x509/x509_v3.c
parentfa08e2c84e0a0e8e5bf7d6555c2d777de37d8413 (diff)
X509v3_add_ext(): do not free stuff we did not allocate in the error path.
ok bcook@
Diffstat (limited to 'lib/libcrypto/x509/x509_v3.c')
-rw-r--r--lib/libcrypto/x509/x509_v3.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libcrypto/x509/x509_v3.c b/lib/libcrypto/x509/x509_v3.c
index a745e6f71ba..3d3a96f59b7 100644
--- a/lib/libcrypto/x509/x509_v3.c
+++ b/lib/libcrypto/x509/x509_v3.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: x509_v3.c,v 1.10 2014/07/11 08:44:49 jsing Exp $ */
+/* $OpenBSD: x509_v3.c,v 1.11 2014/09/28 10:53:57 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -185,7 +185,7 @@ err:
err2:
if (new_ex != NULL)
X509_EXTENSION_free(new_ex);
- if (sk != NULL)
+ if (sk != NULL && (x != NULL && sk != *x))
sk_X509_EXTENSION_free(sk);
return (NULL);
}