]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
use evp_asym_cipher_free in evp_asym_cipher_from_algorithm
authorNeil Horman <nhorman@openssl.org>
Fri, 26 Jun 2026 15:17:09 +0000 (11:17 -0400)
committerNeil Horman <nhorman@openssl.org>
Wed, 1 Jul 2026 15:32:12 +0000 (11:32 -0400)
evp_asym_cipher_from_algorithm, in its error path frees the allocated
cipher with EVP_ASM_CIPHER_free, but thats a no-op now, and we actually want to
free it to avoid leaks, so we should use evp_asym_cipher_free (the internal
function that acutally does free the alg) instead.

Fixes https://scan5.scan.coverity.com/#/project-view/60762/10222?selectedIssue=1695449

Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed Jul  1 15:32:25 2026
(Merged from https://github.com/openssl/openssl/pull/31748)

crypto/evp/asymcipher.c

index 78dbb7e2f587e6f378053b3feb30fd135d5eedaf..c449848ae03706f3624fd61492b4f9050c980d1f 100644 (file)
@@ -453,7 +453,7 @@ static void *evp_asym_cipher_from_algorithm(int name_id,
 
     return cipher;
 err:
-    EVP_ASYM_CIPHER_free(cipher);
+    evp_asym_cipher_free(cipher);
     return NULL;
 }