Fix memory leak in GENERAL_NAME_set0_othername.
authorXiangyu Bu <xybu@users.noreply.github.com>
Wed, 18 Oct 2017 00:10:53 +0000 (17:10 -0700)
committerRichard Levitte <levitte@openssl.org>
Tue, 24 Oct 2017 08:40:45 +0000 (10:40 +0200)
CLA: trivial

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4544)

(cherry picked from commit 04761b557a53f026630dd5916b2b8522d94579db)

crypto/x509v3/v3_genn.c

index 7f40bfabe0507a484db1031bcedbec047f453030..9bb01ee38e6304edae7097645b4132919aa3da0d 100644 (file)
@@ -231,6 +231,7 @@ int GENERAL_NAME_set0_othername(GENERAL_NAME *gen,
     oth = OTHERNAME_new();
     if (!oth)
         return 0;
+    ASN1_TYPE_free(oth->value);
     oth->type_id = oid;
     oth->value = value;
     GENERAL_NAME_set0_value(gen, GEN_OTHERNAME, oth);