From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Borkmann Subject: Re: [PATCH trinity v2, RFT] trinity: use Boehm-Demers-Weiser's garbage collecting memory allocator Date: Mon, 03 Jun 2013 13:54:07 +0200 Message-ID: <51AC83DF.5020203@redhat.com> References: <1369564593-18728-1-git-send-email-dborkman@redhat.com> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: trinity-owner@vger.kernel.org List-ID: Content-Type: text/plain; charset="us-ascii"; format="flowed" To: Tommi Rantala Cc: Dave Jones , trinity@vger.kernel.org On 06/03/2013 08:25 AM, Tommi Rantala wrote: > 2013/5/26 Daniel Borkmann : >> diff --git a/devices.c b/devices.c >> index 0493c39..2e115f8 100644 >> --- a/devices.c >> +++ b/devices.c >> @@ -8,6 +8,7 @@ >> #include >> #include >> >> +#include "trinity.h" >> #include "log.h" >> >> static struct { >> @@ -37,9 +38,9 @@ static void parse_proc_devices(void) >> block = 1; >> else if (sscanf(line, "%d %as", &major, &name) == 2) { >> if (block) { >> - new = realloc(block_devs, (bldevs+1)*sizeof(*block_devs)); >> + new = bdw_realloc(block_devs, (bldevs+1)*sizeof(*block_devs)); >> if (!new) { >> - free(name); >> + bdw_free(name); >> continue; >> } >> block_devs = new; >> @@ -48,9 +49,9 @@ static void parse_proc_devices(void) >> block_devs[bldevs].name = name; >> bldevs++; >> } else { >> - new = realloc(char_devs, (chrdevs+1)*sizeof(*char_devs)); >> + new = bdw_realloc(char_devs, (chrdevs+1)*sizeof(*char_devs)); >> if (!new) { >> - free(name); >> + bdw_free(name); >> continue; >> } >> char_devs = new; >> @@ -63,7 +64,7 @@ static void parse_proc_devices(void) >> } >> >> fclose(fp); >> - free(line); >> + bdw_free(line); >> } > > 'line' is allocated implicitly by getline(), is it safe to bdw_free() it? True, thanks for catching! Not sure if we want to proceed with this patch or put it on hold for now? Let me know, if wished, I could send an update.