From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4676 invoked by alias); 3 Oct 2005 15:15:53 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 4666 invoked by uid 22791); 3 Oct 2005 15:15:51 -0000 Received: from qnxmail.qnx.com (HELO nimbus.ott.qnx.com) (209.226.137.76) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Mon, 03 Oct 2005 15:15:51 +0000 Received: from [10.42.102.103] (STIMPY [10.42.102.103]) by nimbus.ott.qnx.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2653.13) id TX9QVFKA; Mon, 3 Oct 2005 11:15:49 -0400 Message-ID: <43414B1C.3070705@qnx.com> Date: Mon, 03 Oct 2005 15:15:00 -0000 From: Kris Warkentin User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) MIME-Version: 1.0 To: Daniel Jacobowitz CC: gdb-patches@sources.redhat.com 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> <20051003144022.GA21326@nevyn.them.org> In-Reply-To: <20051003144022.GA21326@nevyn.them.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2005-10/txt/msg00021.txt.bz2 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.