[RFA 3/8] Introduce and use gdb::unlinker

Pedro Alves palves@redhat.com
Fri Dec 2 13:17:00 GMT 2016


On 11/29/2016 05:05 AM, Tom Tromey wrote:
> This introduces a new class, gdb::unlinker, that unlinks a file in the
> destructor.  The user of this class has the option to preserve the
> file instead, by calling the "keep" method.

Thanks.

> 
> This patch then changes the spots in gdb that use unlink in a cleanup
> to use this class instead.  In one spot I went ahead and removed all
> the cleanups from the function.
> 
> This fixes one latent bug -- do_bfd_delete_cleanup could refer to
> freed memory, by decref'ing the BFD before using its filename.

LGTM.

Thanks,
Pedro Alves



More information about the Gdb-patches mailing list