summaryrefslogtreecommitdiffstats
path: root/crypto/asn1/f_int.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2016-08-05 16:21:26 +0100
committerDr. Stephen Henson <steve@openssl.org>2016-08-05 16:46:09 +0100
commite1be1dce7722ee40ced16b1b91d5e1b9fce13d08 (patch)
tree926d79632df2c6581cba200c3a0b8db64de9a120 /crypto/asn1/f_int.c
parent32baafb2f6fb2a424824df08232d86765f554880 (diff)
Leak fixes.
Fix error path leaks in a2i_ASN1_STRING(), a2i_ASN1_INTEGER() and a2i_ASN1_ENUMERATED(). Thanks to Shi Lei for reporting these issues. Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/asn1/f_int.c')
-rw-r--r--crypto/asn1/f_int.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/asn1/f_int.c b/crypto/asn1/f_int.c
index 4a81f81c88..2bdc78d744 100644
--- a/crypto/asn1/f_int.c
+++ b/crypto/asn1/f_int.c
@@ -172,8 +172,6 @@ int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size)
sp = OPENSSL_realloc_clean(s, slen, num + i * 2);
if (sp == NULL) {
ASN1err(ASN1_F_A2I_ASN1_INTEGER, ERR_R_MALLOC_FAILURE);
- if (s != NULL)
- OPENSSL_free(s);
goto err;
}
s = sp;
@@ -211,5 +209,7 @@ int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size)
err_sl:
ASN1err(ASN1_F_A2I_ASN1_INTEGER, ASN1_R_SHORT_LINE);
}
+ if (ret != 1)
+ OPENSSL_free(s);
return (ret);
}