pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Avoid double-free in vacuumlo error path.
Date: Sun, 24 Mar 2019 19:13:39 +0000
Message-ID: <E1h88Yt-0001qz-LU@gemulon.postgresql.org> (raw)

Avoid double-free in vacuumlo error path.

The code would do "PQclear(res)" twice if lo_unlink failed, evidently
due to careless thinking about how far out a "break" would break.
Remove the extra PQclear and adjust the loop logic so that we'll fall
out of both levels of loop after an error, as was clearly the intent.

Spotted by Coverity.  I have no idea why it took this long to notice,
since the bug has been there since commit 67ccbb080.  Accordingly,
back-patch to all supported branches.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/bd9396a0b2d42497f1196af74b327e00cb6af435

Modified Files
--------------
contrib/vacuumlo/vacuumlo.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)



view thread (6+ messages)  latest in thread

Message-ID: <E1h88Yt-0001qz-LU@gemulon.postgresql.org>
Permalink:  ../E1h88Yt-0001qz-LU@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1h88Yt-0001qz-LU@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Avoid double-free in vacuumlo error path.
  In-Reply-To: <E1h88Yt-0001qz-LU@gemulon.postgresql.org>
  References: <E1h88Yt-0001qz-LU@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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