From 723412d4d8c8466b1d90b8f348c2c8f24c692f59 Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Thu, 28 Apr 2016 14:00:10 +0100 Subject: [PATCH] Don't leak memory on set_reasons() error path The set_reasons() function in v3_crld.c leaks a STACK_OF(CONF_VALUE) object on an error path. Reviewed-by: Richard Levitte --- crypto/x509v3/v3_crld.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crypto/x509v3/v3_crld.c b/crypto/x509v3/v3_crld.c index 221eedfaeb..c4c77f1851 100644 --- a/crypto/x509v3/v3_crld.c +++ b/crypto/x509v3/v3_crld.c @@ -150,10 +150,10 @@ static int set_reasons(ASN1_BIT_STRING **preas, char *value) const char *bnam; int i, ret = 0; rsk = X509V3_parse_list(value); - if (!rsk) - return 0; - if (*preas) + if (rsk == NULL) return 0; + if (*preas != NULL) + goto err; for (i = 0; i < sk_CONF_VALUE_num(rsk); i++) { bnam = sk_CONF_VALUE_value(rsk, i)->name; if (*preas == NULL) { -- 2.25.1