[PATCH] segment: Fix memory leak in insert()
Maks Mishin
maks.mishinfz@gmail.com
Tue Apr 2 20:32:50 GMT 2024
Dynamic memory, referenced by 'naddr', is allocated at segment.c:66
by calling function 'realloc' and lost at segment.c:92.
Found by RASU JSC.
Signed-off-by: Maks Mishin <maks.mishinFZ@gmail.com>
---
libdwfl/segment.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/libdwfl/segment.c b/libdwfl/segment.c
index f6a3e84e..618c14e6 100644
--- a/libdwfl/segment.c
+++ b/libdwfl/segment.c
@@ -89,6 +89,7 @@ insert (Dwfl *dwfl, size_t i, GElf_Addr start, GElf_Addr end, int segndx)
return true;
}
}
+ free (naddr);
}
if (unlikely (i < dwfl->lookup_elts))
--
2.30.2
More information about the Elfutils-devel
mailing list