public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] readelf/objdump remember_state memory leaks
@ 2023-06-09  6:10 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2023-06-09  6:10 UTC (permalink / raw)
  To: bfd-cvs

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

commit ca5321d49ae1b6d1ec91d4ff79e85dc8ec30576a
Author: Alan Modra <amodra@gmail.com>
Date:   Thu Jun 8 19:58:45 2023 +0930

    readelf/objdump remember_state memory leaks
    
            * dwarf.c (display_debug_frames <DW_CFA_restore_state>): Do free
            invalid remember_state.

Diff:
---
 binutils/dwarf.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 8a20bf2a349..4f695bf2bca 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -9823,12 +9823,14 @@ display_debug_frames (struct dwarf_section *section,
 		    {
 		      warn (_("Invalid column number in saved frame state\n"));
 		      fc->ncols = 0;
-		      break;
 		    }
-		  memcpy (fc->col_type, rs->col_type,
-			  rs->ncols * sizeof (*rs->col_type));
-		  memcpy (fc->col_offset, rs->col_offset,
-			  rs->ncols * sizeof (*rs->col_offset));
+		  else
+		    {
+		      memcpy (fc->col_type, rs->col_type,
+			      rs->ncols * sizeof (*rs->col_type));
+		      memcpy (fc->col_offset, rs->col_offset,
+			      rs->ncols * sizeof (*rs->col_offset));
+		    }
 		  free (rs->col_type);
 		  free (rs->col_offset);
 		  free (rs);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-06-09  6:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-09  6:10 [binutils-gdb] readelf/objdump remember_state memory leaks Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).