This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: xfree/make_cleanup memory leak pattern?


On Wed, 11 Jan 2012 01:25:06 +0100, Khoo Yit Phang wrote:
> I noticed the following code pattern in various places in GDB:
> 	script = compute_python_string (cmd->body_list[0]);
> 	...
> 	xfree (script);
> 
> and also others like:
> 	full_path = tilde_expand (filename);
> 	...
> 	cleanup = make_cleanup (xfree, full_path); 

immediate_quit will cause:
	fatal ("Quit");

which calls throw_exception in the end so all the intermediate cleanup
functions get called.  You can trace/debug it yourself.

I do not see a leak there.  Could you provide some debugging output proving
the memory is being leaked?


Thanks,
Jan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]