The leak is fairly small and rare, but a leak nevertheless.
Per Coverity report. Backpatch to 9.2, where pg_receivexlog was added.
pg_basebackup shares the code, but it always exits on error, so there is
no real leak.
if (!close_walfile(basedir, partial_suffix))
{
/* Error message written in close_walfile() */
+ PQclear(res);
goto error;
}
if (PQresultStatus(res) == PGRES_COPY_IN)
fprintf(stderr,
_("%s: could not send copy-end packet: %s"),
progname, PQerrorMessage(conn));
+ PQclear(res);
goto error;
}
res = PQgetResult(conn);