libdwarf: Make an out-pointer of _dwarf_abbrev_add() mandatory.

All callers pass a non-NULL pointer, and otherwise it was possible to
leak memory if the abbrev was not added to a CU.

CID:		1193365
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Mark Johnston 2020-02-04 21:15:11 +00:00
parent e5551befe8
commit 513e76aaf8

View File

@ -59,9 +59,7 @@ _dwarf_abbrev_add(Dwarf_CU cu, uint64_t entry, uint64_t tag, uint8_t children,
HASH_ADD(ab_hh, cu->cu_abbrev_hash, ab_entry,
sizeof(ab->ab_entry), ab);
if (abp != NULL)
*abp = ab;
*abp = ab;
return (DW_DLE_NONE);
}