pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedpgsql: Fix multiple bugs and infelicities in pg_rewind.
3+ messages / 3 participants
[nested] [flat]
* pgsql: Fix multiple bugs and infelicities in pg_rewind.
@ 2015-03-30 00:02 Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 3+ messages in thread
From: Tom Lane @ 2015-03-30 00:02 UTC (permalink / raw)
To: pgsql-committers
Fix multiple bugs and infelicities in pg_rewind.
Bugs all spotted by Coverity, including wrong realloc() size request
and memory leaks. Cosmetic improvements by me.
The usage of the global variable "filemap" here is still pretty awful,
but at least I got rid of the gratuitous aliasing in several routines
(which was helping to annoy Coverity, as well as being a bug risk).
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/c67f366fa9f748257861ee233b47b80eb5ffa857
Modified Files
--------------
src/bin/pg_rewind/filemap.c | 60 +++++++++++++++++++++------------------
src/bin/pg_rewind/filemap.h | 24 ++++++----------
src/bin/pg_rewind/libpq_fetch.c | 4 +++
src/bin/pg_rewind/pg_rewind.c | 2 +-
4 files changed, 46 insertions(+), 44 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: pgsql: Fix multiple bugs and infelicities in pg_rewind.
@ 2015-04-12 08:46 Michael Paquier <michael.paquier@gmail.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 3+ messages in thread
From: Michael Paquier @ 2015-04-12 08:46 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-committers
On Mon, Mar 30, 2015 at 9:02 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Fix multiple bugs and infelicities in pg_rewind.
>
> Bugs all spotted by Coverity, including wrong realloc() size request
> and memory leaks. Cosmetic improvements by me.
>
> The usage of the global variable "filemap" here is still pretty awful,
> but at least I got rid of the gratuitous aliasing in several routines
> (which was helping to annoy Coverity, as well as being a bug risk).
Coverity points out that a call to PQclear() in receiveFileChunks of
libpq_fetch.c is missing as the result still leaks resources when
status is PGRES_TUPLES_OK. Please see the patch attached.
--
Michael
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
Attachments:
20150412_pgrewind_leak.patch (text/x-patch, 358B) download
diff --git a/src/bin/pg_rewind/libpq_fetch.c b/src/bin/pg_rewind/libpq_fetch.c
index 23c971a..e696554 100644
--- a/src/bin/pg_rewind/libpq_fetch.c
+++ b/src/bin/pg_rewind/libpq_fetch.c
@@ -231,6 +231,7 @@ receiveFileChunks(const char *sql)
break;
case PGRES_TUPLES_OK:
+ PQclear(res);
continue; /* final zero-row result */
default:
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: pgsql: Fix multiple bugs and infelicities in pg_rewind.
@ 2015-04-12 19:48 Heikki Linnakangas <hlinnaka@iki.fi>
parent: Michael Paquier <michael.paquier@gmail.com>
0 siblings, 0 replies; 3+ messages in thread
From: Heikki Linnakangas @ 2015-04-12 19:48 UTC (permalink / raw)
To: Michael Paquier <michael.paquier@gmail.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-committers
On 04/12/2015 11:46 AM, Michael Paquier wrote:
> On Mon, Mar 30, 2015 at 9:02 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Fix multiple bugs and infelicities in pg_rewind.
>>
>> Bugs all spotted by Coverity, including wrong realloc() size request
>> and memory leaks. Cosmetic improvements by me.
>>
>> The usage of the global variable "filemap" here is still pretty awful,
>> but at least I got rid of the gratuitous aliasing in several routines
>> (which was helping to annoy Coverity, as well as being a bug risk).
>
> Coverity points out that a call to PQclear() in receiveFileChunks of
> libpq_fetch.c is missing as the result still leaks resources when
> status is PGRES_TUPLES_OK. Please see the patch attached.
Applied, thanks.
- Heikki
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2015-04-12 19:48 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-03-30 00:02 pgsql: Fix multiple bugs and infelicities in pg_rewind. Tom Lane <tgl@sss.pgh.pa.us>
2015-04-12 08:46 ` Michael Paquier <michael.paquier@gmail.com>
2015-04-12 19:48 ` Heikki Linnakangas <hlinnaka@iki.fi>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox