Re: Memory leak fixes for pg_dump, pg_dumpall, initdb and pg_upgrade

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Memory leak fixes for pg_dump, pg_dumpall, initdb and pg_upgrade
Date: 2015-06-08 13:35:40
Message-ID: CAB7nPqQYXQU8ODCZCDGtGGTxcYP-WY57t-G2qd-EAa9kTTB7Vg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jun 8, 2015 at 10:26 PM, Michael Paquier
<michael(dot)paquier(at)gmail(dot)com> wrote:
> On Mon, Jun 8, 2015 at 3:48 PM, Michael Paquier
> <michael(dot)paquier(at)gmail(dot)com> wrote:
>> Hi all,
>>
>> Please find attached a set of fixes for a couple of things in src/bin:
>> - pg_dump/pg_dumpall:
>> -- getFormattedTypeName, convertTSFunction and myFormatType return
>> strdup'd results that are never free'd.
>> -- convertTSFunction returns const char. I fail to see the point of
>> that... In my opinion we are fine with just returning a char pointer,
>> which is strdup'd so as it can be freed by the caller.
>> - initdb's and pg_regress' use getaddrinfo, but do not free the
>> returned result with freeaddrinfo().
>> - Coverity noticed on the way some leaked memory in pg_upgrade's
>> equivalent_locale().
>>
>> Those issues have been mostly spotted by Coverity, I may have spotted
>> some of them while looking at similar code paths... In any case that's
>> Coverity's win ;)
>
> Attached are new patches, I simplified the use of free in the fixes of
> pg_dumpall.

Please ignore those versions, I am just too sleepy...
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2015-06-08 13:50:25 Re: Collection of memory leaks for ECPG driver
Previous Message Michael Paquier 2015-06-08 13:26:37 Re: Memory leak fixes for pg_dump, pg_dumpall, initdb and pg_upgrade