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

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

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:16 2026
(Merged from https://github.com/openssl/openssl/pull/31748)

crypto/evp/kem.c

index 48de927ce43e8eaeda0abc7ea25d3138001e3b58..ec83236ab4c81bcce0b815726fc205688305b7aa 100644 (file)
@@ -442,7 +442,7 @@ static void *evp_kem_from_algorithm(int name_id, const OSSL_ALGORITHM *algodef,
 
     return kem;
 err:
-    EVP_KEM_free(kem);
+    evp_kem_free(kem);
     return NULL;
 }