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:
Mark Johnston 2020-02-04 21:15:29 +00:00
parent 513e76aaf8
commit ab3b51df28
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=357534

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 */