]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
crypto/property/property.c: avoid NULL dereference in impl_cache_free()
authorEugene Syromiatnikov <esyr@openssl.org>
Wed, 25 Mar 2026 11:41:32 +0000 (12:41 +0100)
committerEugene Syromiatnikov <esyr@openssl.org>
Tue, 31 Mar 2026 00:32:58 +0000 (02:32 +0200)
Dereference elem only after checking it for NULL.  Reported by Coverity,
CID 1690442.

Resolves: https://scan5.scan.coverity.com/#/project-view/65248/10222?selectedIssue=1690442
Fixes: 95ac190979ec "convert ALGORITHM cache to use internal hashtable"
Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
MergeDate: Tue Mar 31 00:33:21 2026
(Merged from https://github.com/openssl/openssl/pull/30566)

crypto/property/property.c

index 598484fb0b522d5c8637823966bcf84d394ca0bf..13017e4af13db22b4c29fa1253f53fc9d18d0066 100644 (file)
@@ -257,9 +257,9 @@ static void impl_free(IMPLEMENTATION *impl)
 
 static ossl_inline void impl_cache_free(QUERY *elem)
 {
-    STORED_ALGORITHMS *sa = elem->saptr;
-
     if (elem != NULL) {
+        STORED_ALGORITHMS *sa = elem->saptr;
+
 #ifndef NDEBUG
         if (elem->ossl_list_lru_entry.list != NULL)
             ossl_list_lru_entry_remove(&sa->lru_list, elem);