This is the mail archive of the gdb-patches@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: [patch] clean up potential memory leak in thread.c


Actually, that's a pretty good idea. We do that in a number of other places and I suppose it's no harder to realloc the whole structure than to just re-create the thread name string.

Consider the patch withdrawn.

cheers,

Kris

Daniel Jacobowitz wrote:

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


-- Stay up-to-date on all the QNX news! Register at http://www.qnx.com/news/forms/newsletter.html to receive our newsletter.


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