This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] clean up potential memory leak in thread.c
- From: Daniel Jacobowitz <drow at false dot org>
- To: Kris Warkentin <kewarken at qnx dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Mon, 3 Oct 2005 10:40:22 -0400
- Subject: Re: [patch] clean up potential memory leak in thread.c
- References: <433C21F1.9000903@qnx.com> <20051002201953.GA31820@nevyn.them.org> <43414074.3010506@qnx.com>
On Mon, Oct 03, 2005 at 10:30:12AM -0400, Kris Warkentin wrote:
> We're throwing named thread support into the kernel so I'm keeping an
> arbitrary length string in there. Would never be a huge memory leak but
> I'm fussy that way.
You don't actually need this to add an arbitrary lenth string; the
target gets to malloc this, you can use a trailing char[1] or simply
malloc sizeof(struct) + strlen (char) + 1 and point the char* right
after the struct.
If it's clearer to do it this way, though, we can go with your patch.
If you'd rather do that let me know; IIRC there were some formatting
glitches.
--
Daniel Jacobowitz
CodeSourcery, LLC