https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88063

--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #4)
> Comment on attachment 45048 [details]
> Proposed patch
> 
> >@@ -1476,6 +1483,15 @@ build_address_map (struct backtrace_stat
> >        backtrace_alloc (state, sizeof *u, error_callback, data));
> >       if (u == NULL)
> >     goto fail;
> >+
> >+      pu = ((struct unit **)
> >+        backtrace_vector_grow (state, sizeof (struct unit *),
> >+                               error_callback, data, &units));
> >+      if (pu == NULL)
> 
> This introduces another memory leak, this is missing here:
> ...
>       {
>       backtrace_free (state, u, sizeof *u, error_callback, data);
> ...
> 
> >+    goto fail;
> 
> ...
>       }
> ...
> 
> [ Btw, note that if we move the u and pu allocations to before read_abbrevs,
> we can read the abbrevs directly into u->abbrevs, and can get rid of the
> "free_abbrevs (&abbrevs)" at the end. Perhaps that's worth a separate patch.
> ]
> 

Hmm, likewise, if we move the pu allocation before the u allocation, we can
drop the "backtrace_free (state, u, sizeof *u, error_callback, data);".

Reply via email to