Free buffer on error in a2i_ASN1_INTEGER()
authorMatt Caswell <matt@openssl.org>
Wed, 27 Apr 2016 13:50:32 +0000 (14:50 +0100)
committerMatt Caswell <matt@openssl.org>
Wed, 1 Jun 2016 17:00:53 +0000 (18:00 +0100)
The function a2i_ASN1_INTEGER() allocates a buffer |s| but then fails
to free it on error paths.

Reviewed-by: Richard Levitte <levitte@openssl.org>
crypto/asn1/f_int.c

index 15aece99e8863620f8d1dee43aa3dcc0c4014e2b..0f16ac0bbbddc842bed08d196237a32b6da6da90 100644 (file)
@@ -148,6 +148,7 @@ int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size)
     return 1;
  err:
     ASN1err(ASN1_F_A2I_ASN1_INTEGER, ASN1_R_SHORT_LINE);
+    OPENSSL_free(s);
     return 0;
 }