[binutils-gdb] binutils/dwarf.c abbrev list leak

Alan Modra amodra@sourceware.org
Wed Aug 30 03:16:52 GMT 2023


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=02838630379cf76554a53be182bd9ad05a5a2a4d

commit 02838630379cf76554a53be182bd9ad05a5a2a4d
Author: Alan Modra <amodra@gmail.com>
Date:   Wed Aug 30 11:10:58 2023 +0930

    binutils/dwarf.c abbrev list leak
    
            * dwarf.c (process_debug_info): Call free_abrev_list on
            return paths.

Diff:
---
 binutils/dwarf.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 80bbc547bb1..9e22a74209e 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -3997,7 +3997,11 @@ process_debug_info (struct dwarf_section * section,
 		    }
 		}
 	      if (dwarf_start_die != 0 && level < saved_level)
-		return true;
+		{
+		  if (list != NULL)
+		    free_abbrev_list (list);
+		  return true;
+		}
 	      continue;
 	    }
 
@@ -4038,6 +4042,8 @@ process_debug_info (struct dwarf_section * section,
 		}
 	      warn (_("DIE at offset %#lx refers to abbreviation number %lu which does not exist\n"),
 		    die_offset, abbrev_number);
+	      if (list != NULL)
+		free_abbrev_list (list);
 	      return false;
 	    }


More information about the Binutils-cvs mailing list