Re: BUG #6672: Memory leaks in dumputils.c

From: Anna Zaks <zaks(dot)anna(at)gmail(dot)com>
To: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #6672: Memory leaks in dumputils.c
Date: 2012-06-01 18:38:19
Message-ID: CA+=xKSUav_nMDbQ8AFW=GDUPkoWSZyeUM1mWtk=30agWrF8_DQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Jun 1, 2012 at 11:13 AM, Josh Kupershmidt <schmiddy(at)gmail(dot)com> wrote:
> On Thu, May 31, 2012 at 10:06 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> zaks(dot)anna(at)gmail(dot)com writes:
>
>>> There are two memory leaks in dumputils (v9.2.0beta1):
>>
>>> 1)
>>> File:   src/bin/scripts/dumputils.c
>>> Location:       line 604, column 11
>>> Description:    Memory is never released; potential leak of memory
>>> pointed to by 'aclitems'
>>
>>> 2)
>>> File:   src/bin/scripts/dumputils.c
>>> Location:       line 793, column 10
>>> Description:    Memory is never released; potential leak of memory
>>> pointed to by 'eqpos'
>>
>> This is a remarkably unhelpful report.  I do not see any memory
>> allocation occurring on either line 604 or line 793 of dumputils.c,
>> in either 9.2beta1 or 9.1.3.  Could you perhaps provide source code
>> extracts rather than line numbers that reference indeterminate versions
>> of files?
>
> I suspect the first complaint is about this bit in git head's
> ./src/bin/pg_dump/dumputils.c:
>
>        if (!parseAclItem(aclitems[i], type, name, subname, remoteVersion,
>                          grantee, grantor, privs, privswgo))
>            return false;
>
> since 'aclitems' isn't being freed before the return. And the second
> complaint seems to concern parseAclItem() not freeing 'buf' when it
> returns false. Both of these errors seem academic, since the callers
> of buildACLCommands() will bail out with exit_horribly() or
> exit_nicely() if it returns false. But IMO it's worth fixing anyway,
> to keep the compilers happy or in case of future code calling
> buildACLCommands() or parseAclItem().
>
> Attached is a patch to hopefully fix those two errors. I couldn't
> quite verify this fixes the OP's error messages, since "checker-266"
> isn't done running make after several hours on this OS X machine.
>

Josh,

What kid of machine are you using? Please, let me know how long it
took after it's done (It takes about one and a half hours on mine).

Thanks,
Anna.
> Josh

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Josh Kupershmidt 2012-06-01 18:53:56 Re: BUG #6672: Memory leaks in dumputils.c
Previous Message Josh Kupershmidt 2012-06-01 18:13:23 Re: BUG #6672: Memory leaks in dumputils.c