ASN1: Ensure that d2i_ASN1_OBJECT() frees the strings on ASN1_OBJECT reuse
authorRichard Levitte <levitte@openssl.org>
Tue, 20 Apr 2021 06:43:30 +0000 (08:43 +0200)
committerRichard Levitte <levitte@openssl.org>
Tue, 27 Apr 2021 10:43:52 +0000 (12:43 +0200)
commit1727465471e800548694da96b8970743b7efa7ff
tree6e91c487b2c0f951c985f5c27dfc699abad50c4e
parent94471ccfdab810a3cdc35116831c231ca277d814
ASN1: Ensure that d2i_ASN1_OBJECT() frees the strings on ASN1_OBJECT reuse

The 'sn' and 'ln' strings may be dynamically allocated, and the
ASN1_OBJECT flags have a bit set to say this.  If an ASN1_OBJECT with
such strings is passed to d2i_ASN1_OBJECT() for reuse, the strings
must be freed, or there is a memory leak.

Fixes #14667

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/14938)

(cherry picked from commit 65b88a75921533ada8b465bc8d5c0817ad927947)
crypto/asn1/a_object.c