From 7fb113f01f33bd11b017bc4893c2d1291f4cf1a3 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 1 Jan 2025 20:37:47 +0100 Subject: [PATCH] hash: add asserts in hash_element_dtor() This just adds a precaution and shows a clear intention in the code. Added because CodeSonar is reporting a false positive Use After Free on this function. Closes #15889 --- lib/hash.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/hash.c b/lib/hash.c index 1910ac5dc4..aa9904e709 100644 --- a/lib/hash.c +++ b/lib/hash.c @@ -42,6 +42,8 @@ hash_element_dtor(void *user, void *element) { struct Curl_hash *h = (struct Curl_hash *) user; struct Curl_hash_element *e = (struct Curl_hash_element *) element; + DEBUGASSERT(h); + DEBUGASSERT(e); if(e->ptr) { if(e->dtor)