summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2016-11-13 08:47:55 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2016-11-13 08:47:55 +0000
commitdb12dce0692b150c036d80e48f1d50eeb9f66d7e (patch)
tree1065d4577d5491a3209cdb0c67df5af252b9eca3
parent2a1a01384d8d9f2f7ab45b8a924cc77911d92402 (diff)
Fix previous change to X509_STORE_add_{cert,crl} to not free the input
object in the error path - we don't own it.
-rw-r--r--lib/libcrypto/x509/x509_lu.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/libcrypto/x509/x509_lu.c b/lib/libcrypto/x509/x509_lu.c
index fc1256788eb..d8d0bb41476 100644
--- a/lib/libcrypto/x509/x509_lu.c
+++ b/lib/libcrypto/x509/x509_lu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: x509_lu.c,v 1.21 2016/11/08 21:22:55 miod Exp $ */
+/* $OpenBSD: x509_lu.c,v 1.22 2016/11/13 08:47:54 miod Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -376,8 +376,10 @@ X509_STORE_add_cert(X509_STORE *ctx, X509 *x)
CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
- if (ret == 0)
+ if (ret == 0) {
+ obj->data.x509 = NULL; /* owned by the caller */
X509_OBJECT_free(obj);
+ }
return ret;
}
@@ -419,8 +421,10 @@ X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x)
CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
- if (ret == 0)
+ if (ret == 0) {
+ obj->data.crl = NULL; /* owned by the caller */
X509_OBJECT_free(obj);
+ }
return ret;
}