]> granicus.if.org Git - postgresql/commit
Avoid double-free in vacuumlo error path.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 24 Mar 2019 19:13:21 +0000 (15:13 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 24 Mar 2019 19:13:21 +0000 (15:13 -0400)
commite484f07015cdcb9b6ba772760f16fdf2d76c8b2f
treeb17195ee94973a93390613e7d6750f278a3e9c99
parente23d44016d5193bb824fd637d277cbaa1fc6002c
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.
contrib/vacuumlo/vacuumlo.c