Coverity Reported a Leak in libdwarf
Summary
Coverity Scan reports a resource leak.
** CID 1595466: Resource leaks (RESOURCE_LEAK) /rtemstoolkit/elftoolchain/libdwarf/dwarf_abbrev.c: 51 in dwarf_get_abbrev()
Details
This is the detailed information provided.
*** CID 1595466: Resource leaks (RESOURCE_LEAK)
/rtemstoolkit/elftoolchain/libdwarf/dwarf_abbrev.c: 51 in dwarf_get_abbrev()
45 ret = _dwarf_abbrev_parse(dbg, NULL, &offset, &ab, error);
46 if (ret != DW_DLE_NONE) {
47 if (ret == DW_DLE_NO_ENTRY) {
48 DWARF_SET_ERROR(dbg, error, DW_DLE_NO_ENTRY);
49 return (DW_DLV_NO_ENTRY);
50 } else
>>> CID 1595466: Resource leaks (RESOURCE_LEAK)
>>> Variable "ab" going out of scope leaks the storage it points to.
51 return (DW_DLV_ERROR);
52 }
53
54 *return_abbrev = ab;
55 *length = ab->ab_length;
56 *attr_count = ab->ab_atnum;
Edited by Amar Takhar