libdwarf: Fix a memory leak in _dwarf_frame_section_init().

If frame length validation failed we would leak memory.

CID:		1193366
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
markj 2020-02-04 21:15:29 +00:00
parent a56c1d6a0c
commit 6f9bba703e

View File

@ -468,9 +468,9 @@ _dwarf_frame_section_init(Dwarf_Debug dbg, Dwarf_FrameSec *frame_sec,
if (length > ds->ds_size - offset ||
(length == 0 && !eh_frame)) {
DWARF_SET_ERROR(dbg, error,
DW_DLE_DEBUG_FRAME_LENGTH_BAD);
return (DW_DLE_DEBUG_FRAME_LENGTH_BAD);
ret = DW_DLE_DEBUG_FRAME_LENGTH_BAD;
DWARF_SET_ERROR(dbg, error, ret);
goto fail_cleanup;
}
/* Check terminator for .eh_frame */