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: Memory leak fixes for pg_dump, pg_dumpall, initdb and pg_upgrade
Date: 2015-06-08 06:48:51
Message-ID: CAB7nPqSfN4aC4-tCsfDovNBRRy16BnvXhbz3SVbYsugu+bvPyg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 ;)
Regards,
--
Michael

Attachment Content-Type Size
0001-Fix-some-memory-leaks-in-pg_dump-and-pg_dumpall.patch text/x-patch 8.6 KB
0002-Additional-leak-fixes-for-src-bin-stuff.patch text/x-patch 2.6 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2015-06-08 06:52:57 Re: [GENERAL] 9.4.1 -> 9.4.2 problem: could not access status of transaction 1
Previous Message Peter Geoghegan 2015-06-08 06:09:48 Re: amcheck prototype