From: Daniel Stenberg Date: Wed, 1 Jan 2025 19:37:47 +0000 (+0100) Subject: hash: add asserts in hash_element_dtor() X-Git-Tag: curl-8_12_0~216 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7fb113f01f33bd11b017bc4893c2d1291f4cf1a3;p=thirdparty%2Fcurl.git 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 --- 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)