From ad64bd77855220f45e0e3adbd4f6ffa738a5a7d2 Mon Sep 17 00:00:00 2001 From: miod <> Date: Mon, 20 Jul 2015 15:29:13 +0000 Subject: When freeing an X509_CRL, if freeing the user-maintained meth_data fails, do not forgot to nevertheless keep freeing the other fields. ok doug@ guenther@ --- src/lib/libcrypto/asn1/x_crl.c | 7 ++++--- src/lib/libssl/src/crypto/asn1/x_crl.c | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/lib/libcrypto/asn1/x_crl.c b/src/lib/libcrypto/asn1/x_crl.c index 7b76d2ec47..6062587ed4 100644 --- a/src/lib/libcrypto/asn1/x_crl.c +++ b/src/lib/libcrypto/asn1/x_crl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_crl.c,v 1.24 2015/02/11 04:00:39 jsing Exp $ */ +/* $OpenBSD: x_crl.c,v 1.25 2015/07/20 15:29:13 miod Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -270,6 +270,7 @@ crl_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg) STACK_OF(X509_EXTENSION) *exts; X509_EXTENSION *ext; int idx; + int rc = 1; switch (operation) { case ASN1_OP_NEW_POST: @@ -345,7 +346,7 @@ crl_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg) case ASN1_OP_FREE_POST: if (crl->meth->crl_free) { if (!crl->meth->crl_free(crl)) - return 0; + rc = 0; } if (crl->akid) AUTHORITY_KEYID_free(crl->akid); @@ -356,7 +357,7 @@ crl_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg) sk_GENERAL_NAMES_pop_free(crl->issuers, GENERAL_NAMES_free); break; } - return 1; + return rc; } /* Convert IDP into a more convenient form */ diff --git a/src/lib/libssl/src/crypto/asn1/x_crl.c b/src/lib/libssl/src/crypto/asn1/x_crl.c index 7b76d2ec47..6062587ed4 100644 --- a/src/lib/libssl/src/crypto/asn1/x_crl.c +++ b/src/lib/libssl/src/crypto/asn1/x_crl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: x_crl.c,v 1.24 2015/02/11 04:00:39 jsing Exp $ */ +/* $OpenBSD: x_crl.c,v 1.25 2015/07/20 15:29:13 miod Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -270,6 +270,7 @@ crl_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg) STACK_OF(X509_EXTENSION) *exts; X509_EXTENSION *ext; int idx; + int rc = 1; switch (operation) { case ASN1_OP_NEW_POST: @@ -345,7 +346,7 @@ crl_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg) case ASN1_OP_FREE_POST: if (crl->meth->crl_free) { if (!crl->meth->crl_free(crl)) - return 0; + rc = 0; } if (crl->akid) AUTHORITY_KEYID_free(crl->akid); @@ -356,7 +357,7 @@ crl_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg) sk_GENERAL_NAMES_pop_free(crl->issuers, GENERAL_NAMES_free); break; } - return 1; + return rc; } /* Convert IDP into a more convenient form */ -- cgit v1.2.3-55-g6feb