[rfa] py-value.c, memory leak

Michael Snyder msnyder@vmware.com
Mon Feb 28 18:58:00 GMT 2011


Tom Tromey wrote:
>>>>>> "Michael" == Michael Snyder <msnyder@vmware.com> writes:
> 
> Michael> Feel like I need review for this...
> Michael> 2011-02-27  Michael Snyder  <msnyder@vmware.com>
> Michael> 	* python/py-value.c (valpy_str): Fix memory leak.
> 
> First, I think the cleanup logic in this function is already a little
> wrong.
> 
> Suppose the code in the TRY_CATCH throws an exception.  Then,
> GDB_PY_HANDLE_EXCEPTION will do an early return -- but `stb' will never
> be freed.
> 
> 
> Second, I don't think this patch is needed.  I don't think there is a
> situation where `s' can be non-NULL and where the early return can be
> taken.  For that to happen, something would have to throw an exception
> between the assignment and the end of the TRY_CATCH, which is impossible.
> 
> Tom

All right -- withdrawn.



More information about the Gdb-patches mailing list