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>
Mon, 23 Oct 2017 15:46:02 +0000 (17:46 +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)

crypto/x509v3/v3_genn.c

index 8d1199748c8653841799dc6e844e5deeac4d3d2a..85fc3fc24672a3c00e6a252aab1e404f4ea506ff 100644 (file)
@@ -181,6 +181,7 @@ int GENERAL_NAME_set0_othername(GENERAL_NAME *gen,
     oth = OTHERNAME_new();
     if (oth == NULL)
         return 0;
     oth = OTHERNAME_new();
     if (oth == NULL)
         return 0;
+    ASN1_TYPE_free(oth->value);
     oth->type_id = oid;
     oth->value = value;
     GENERAL_NAME_set0_value(gen, GEN_OTHERNAME, oth);
     oth->type_id = oid;
     oth->value = value;
     GENERAL_NAME_set0_value(gen, GEN_OTHERNAME, oth);