[clang] [clang] Fix NewDeleteLeaks false negative for heap fields (PR #221587)

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 7 05:07:52 PDT 2026


================
@@ -1771,7 +1771,14 @@ void testMallocIntoMalloc(void) {
   StructWithPtr *s = malloc(sizeof(StructWithPtr));
   s->memP = malloc(sizeof(int));
   free(s);
-} // FIXME: should warn here
----------------
NagyDonat wrote:

But the analyzer _must not_ warn if the last line of this function was `return s;` instead of `free(s)`. If I understand correctly, your patch introduces a false positive in that case.

https://github.com/llvm/llvm-project/pull/221587


More information about the cfe-commits mailing list