Commit b9cd3ae9af for openssl.org

commit b9cd3ae9af17583341c911ec3ef2a7e307e958ac
Author: Eugene Syromiatnikov <esyr@openssl.org>
Date:   Wed Mar 25 12:41:32 2026 +0100

    crypto/property/property.c: avoid NULL dereference in impl_cache_free()

    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)

diff --git a/crypto/property/property.c b/crypto/property/property.c
index 598484fb0b..13017e4af1 100644
--- a/crypto/property/property.c
+++ b/crypto/property/property.c
@@ -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);