]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix memory leak of p and q in ossl_rsa_fromdata error path
authorUni <pedroluiscolmenares722@gmail.com>
Fri, 6 Mar 2026 20:24:28 +0000 (21:24 +0100)
committerNeil Horman <nhorman@openssl.org>
Tue, 10 Mar 2026 15:55:18 +0000 (11:55 -0400)
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
MergeDate: Tue Mar 10 15:52:35 2026
(Merged from https://github.com/openssl/openssl/pull/30298)

(cherry picked from commit 0d5a73eb380acf9ad6e3c45c06c728b94cc44438)

crypto/rsa/rsa_backend.c

index 119ed3f66046ee4d1bf0ec02160efb282e9a35ab..80d9c2132a3066c6ddb1556fa1fd075137322b4b 100644 (file)
@@ -246,6 +246,8 @@ err:
     BN_free(n);
     BN_free(e);
     BN_free(d);
+    BN_clear_free(p);
+    BN_clear_free(q);
     sk_BIGNUM_pop_free(factors, BN_clear_free);
     sk_BIGNUM_pop_free(exps, BN_clear_free);
     sk_BIGNUM_pop_free(coeffs, BN_clear_free);