pgsql: Avoid double-free in vacuumlo error path.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Avoid double-free in vacuumlo error path.
Date: 2019-03-24 19:13:39
Message-ID: E1h88Yt-0001r3-MK@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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
------
REL_10_STABLE

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

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

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Geoghegan 2019-03-24 19:32:50 pgsql: Remove dead code from nbtsplitloc.c.
Previous Message Peter Geoghegan 2019-03-24 18:27:27 Re: pgsql: Make heap TID a tiebreaker nbtree index column.