libbacktrace patch committed: Only free sym_view if it is valid

Message ID CAOyqgcV26oUJMkLrNJS_4PH7zcOpoAq2BUoAyTJa6ETRX=P8Dw@mail.gmail.com
State New
Headers show
Series
  • libbacktrace patch committed: Only free sym_view if it is valid
Related show

Commit Message

Ian Lance Taylor Jan. 25, 2018, 3:38 p.m.
Another libbacktrace patch to avoid use of uninitialized memory: only
free sym_view if it is valid.  Committed to mainline.

Ian

2018-01-25  Ian Lance Taylor  <iant@golang.org>

* pecoff.c (coff_add): Only release syms_view if it is valid.

Patch

Index: pecoff.c
===================================================================
--- pecoff.c	(revision 257052)
+++ pecoff.c	(working copy)
@@ -804,8 +804,11 @@  coff_add (struct backtrace_state *state,
 
   backtrace_release_view (state, &sects_view, error_callback, data);
   sects_view_valid = 0;
-  backtrace_release_view (state, &syms_view, error_callback, data);
-  syms_view_valid = 0;
+  if (syms_view_valid)
+    {
+      backtrace_release_view (state, &syms_view, error_callback, data);
+      syms_view_valid = 0;
+    }
 
   /* Read all the debug sections in a single view, since they are
      probably adjacent in the file.  We never release this view.  */