summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authormiod <>2014-09-28 10:53:57 +0000
committermiod <>2014-09-28 10:53:57 +0000
commit091f5c3e6dfe57ebde616bd69bdc1866949e19a4 (patch)
tree1abf4c2c4a3b6168578fcbaf726cca02e48fca5b /src/lib
parent44e5772239f78dcfb746f5990e534c16c830260a (diff)
downloadopenbsd-091f5c3e6dfe57ebde616bd69bdc1866949e19a4.tar.gz
openbsd-091f5c3e6dfe57ebde616bd69bdc1866949e19a4.tar.bz2
openbsd-091f5c3e6dfe57ebde616bd69bdc1866949e19a4.zip
X509v3_add_ext(): do not free stuff we did not allocate in the error path.
ok bcook@
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/x509/x509_v3.c4
-rw-r--r--src/lib/libssl/src/crypto/x509/x509_v3.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/libcrypto/x509/x509_v3.c b/src/lib/libcrypto/x509/x509_v3.c
index a745e6f71b..3d3a96f59b 100644
--- a/src/lib/libcrypto/x509/x509_v3.c
+++ b/src/lib/libcrypto/x509/x509_v3.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_v3.c,v 1.10 2014/07/11 08:44:49 jsing Exp $ */ 1/* $OpenBSD: x509_v3.c,v 1.11 2014/09/28 10:53:57 miod Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -185,7 +185,7 @@ err:
185err2: 185err2:
186 if (new_ex != NULL) 186 if (new_ex != NULL)
187 X509_EXTENSION_free(new_ex); 187 X509_EXTENSION_free(new_ex);
188 if (sk != NULL) 188 if (sk != NULL && (x != NULL && sk != *x))
189 sk_X509_EXTENSION_free(sk); 189 sk_X509_EXTENSION_free(sk);
190 return (NULL); 190 return (NULL);
191} 191}
diff --git a/src/lib/libssl/src/crypto/x509/x509_v3.c b/src/lib/libssl/src/crypto/x509/x509_v3.c
index a745e6f71b..3d3a96f59b 100644
--- a/src/lib/libssl/src/crypto/x509/x509_v3.c
+++ b/src/lib/libssl/src/crypto/x509/x509_v3.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_v3.c,v 1.10 2014/07/11 08:44:49 jsing Exp $ */ 1/* $OpenBSD: x509_v3.c,v 1.11 2014/09/28 10:53:57 miod Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -185,7 +185,7 @@ err:
185err2: 185err2:
186 if (new_ex != NULL) 186 if (new_ex != NULL)
187 X509_EXTENSION_free(new_ex); 187 X509_EXTENSION_free(new_ex);
188 if (sk != NULL) 188 if (sk != NULL && (x != NULL && sk != *x))
189 sk_X509_EXTENSION_free(sk); 189 sk_X509_EXTENSION_free(sk);
190 return (NULL); 190 return (NULL);
191} 191}