This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Thread bound variable objects
On Tue, Mar 25, 2008 at 12:59:25PM +1200, Nick Roberts wrote:
> OK, I hadn't realised that. I was looking at other files, e.g., dwarf2read.c
> which uses this technique. That appears to just be with xfree so maybe only
> results in a memory leak.
>
> I guess
>
> struct cleanups *old_cleanups = 0x1;
> ...
> if (old_cleanups != 0x1)
> do_cleanups (old_cleanups);
>
> would work but, as you say, it's probably best to use null_cleanup.
Right, that's what it's for. There are a lot of places in GDB that
use the NULL check, but they're bugs waiting to happen.
--
Daniel Jacobowitz
CodeSourcery