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)
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);