Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Feb 2020 21:14:54 +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: r357532 - head/contrib/elftoolchain/libdwarf
Message-ID:  <202002042114.014LEs0O018775@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Tue Feb  4 21:14:53 2020
New Revision: 357532
URL: https://svnweb.freebsd.org/changeset/base/357532

Log:
  libdwarf: Fix a possible memory leak in dwarf_add_AT_location_expr().
  
  CID:		1193364
  MFC after:	1 week
  Sponsored by:	The FreeBSD Foundation

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

Modified: head/contrib/elftoolchain/libdwarf/dwarf_pro_attr.c
==============================================================================
--- head/contrib/elftoolchain/libdwarf/dwarf_pro_attr.c	Tue Feb  4 21:14:34 2020	(r357531)
+++ head/contrib/elftoolchain/libdwarf/dwarf_pro_attr.c	Tue Feb  4 21:14:53 2020	(r357532)
@@ -46,8 +46,10 @@ dwarf_add_AT_location_expr(Dwarf_P_Debug dbg, Dwarf_P_
 	at->at_attrib = attr;
 	at->at_expr = loc_expr;
 
-	if (_dwarf_expr_into_block(loc_expr, error) != DW_DLE_NONE)
+	if (_dwarf_expr_into_block(loc_expr, error) != DW_DLE_NONE) {
+		free(at);
 		return (DW_DLV_BADADDR);
+	}
 	at->u[0].u64 = loc_expr->pe_length;
 	at->u[1].u8p = loc_expr->pe_block;
 	if (loc_expr->pe_length <= UCHAR_MAX)



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