Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Feb 2020 21:15:29 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r357534 - head/contrib/elftoolchain/libdwarf
Message-ID:  <202002042115.014LFTCU018907@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202002042115.014LFTCU018907>