Author: markj
Date: Tue Feb  4 21:15:29 2020
New Revision: 357534
URL: https://svnweb.freebsd.org/changeset/base/357534

Log:
  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

Modified:
  head/contrib/elftoolchain/libdwarf/libdwarf_frame.c

Modified: head/contrib/elftoolchain/libdwarf/libdwarf_frame.c
==============================================================================
--- head/contrib/elftoolchain/libdwarf/libdwarf_frame.c Tue Feb  4 21:15:11 
2020        (r357533)
+++ head/contrib/elftoolchain/libdwarf/libdwarf_frame.c Tue Feb  4 21:15:29 
2020        (r357534)
@@ -468,9 +468,9 @@ _dwarf_frame_section_init(Dwarf_Debug dbg, Dwarf_Frame
 
                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 */
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to