diff options
author | Allan <allanchang96@gmail.com> | 2022-07-07 16:04:09 -0700 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2022-07-11 10:50:56 +0200 |
commit | 4798e0680b112993815098ca21d7d68ff31ebc6e (patch) | |
tree | 30c07be39fdbe5d6f60a7fe0c171b3810b4a2660 /crypto | |
parent | 695cb63c744bab090144a86949b68324ee3094d6 (diff) | |
download | openssl-new-4798e0680b112993815098ca21d7d68ff31ebc6e.tar.gz |
Fix memory leak in X509V3_add1_i2d when flag is X509V3_ADD_DELETE
Fixes #18677
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18698)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/x509/v3_lib.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto/x509/v3_lib.c b/crypto/x509/v3_lib.c index 42b6ff1527..5c05b56d9c 100644 --- a/crypto/x509/v3_lib.c +++ b/crypto/x509/v3_lib.c @@ -242,8 +242,10 @@ int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) **x, int nid, void *value, } /* If delete, just delete it */ if (ext_op == X509V3_ADD_DELETE) { - if (!sk_X509_EXTENSION_delete(*x, extidx)) + extmp = sk_X509_EXTENSION_delete(*x, extidx); + if (extmp == NULL) return -1; + X509_EXTENSION_free(extmp); return 1; } } else { |