diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2016-08-05 16:21:26 +0100 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2016-08-05 18:06:56 +0100 |
commit | d23de0bbf9e2c7a64065e2bf1907c6cceda78eb9 (patch) | |
tree | 4624a58351357b82036fd48904dd4c7064cab20c /crypto/asn1/f_enum.c | |
parent | 3c39313f7bba2663961f6085bcd010e61004fe6e (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>
(cherry picked from commit e1be1dce7722ee40ced16b1b91d5e1b9fce13d08)
Diffstat (limited to 'crypto/asn1/f_enum.c')
-rw-r--r-- | crypto/asn1/f_enum.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/asn1/f_enum.c b/crypto/asn1/f_enum.c index 591c3b5781..94cd54dbee 100644 --- a/crypto/asn1/f_enum.c +++ b/crypto/asn1/f_enum.c @@ -160,8 +160,6 @@ int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size) i * 2); if (sp == NULL) { ASN1err(ASN1_F_A2I_ASN1_ENUMERATED, ERR_R_MALLOC_FAILURE); - if (s != NULL) - OPENSSL_free(s); goto err; } s = sp; @@ -199,5 +197,7 @@ int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size) err_sl: ASN1err(ASN1_F_A2I_ASN1_ENUMERATED, ASN1_R_SHORT_LINE); } + if (ret != 1) + OPENSSL_free(s); return (ret); } |