summaryrefslogtreecommitdiffstats
path: root/crypto/x509v3
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2016-04-28 14:00:10 +0100
committerMatt Caswell <matt@openssl.org>2016-06-01 18:00:53 +0100
commit723412d4d8c8466b1d90b8f348c2c8f24c692f59 (patch)
treea0f57fadcbdf50ee680f31fb106f49eee237d4c3 /crypto/x509v3
parent137e5555bd3d1dc4486619bc524502c55682a6f4 (diff)
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 <levitte@openssl.org>
Diffstat (limited to 'crypto/x509v3')
-rw-r--r--crypto/x509v3/v3_crld.c6
1 files 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) {