Add missing PQclear() calls into pg_receivexlog.
authorFujii Masao
Sat, 2 Aug 2014 06:18:09 +0000 (15:18 +0900)
committerFujii Masao
Sat, 2 Aug 2014 06:19:45 +0000 (15:19 +0900)
Back-patch to 9.3.

src/bin/pg_basebackup/receivelog.c

index 866d4d82eaf04b53b0f114ff83172e3f332792e4..33095304fa72a0deb1d5bb98b0073faacca1c352 100644 (file)
@@ -680,6 +680,7 @@ ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
                fprintf(stderr,
                   _("%s: unexpected termination of replication stream: %s"),
                        progname, PQresultErrorMessage(res));
+               PQclear(res);
                goto error;
            }
            PQclear(res);
@@ -694,6 +695,8 @@ ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
        }
        else if (PQresultStatus(res) == PGRES_COMMAND_OK)
        {
+           PQclear(res);
+
            /*
             * End of replication (ie. controlled shut down of the server).
             *
@@ -715,6 +718,7 @@ ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
            fprintf(stderr,
                    _("%s: unexpected termination of replication stream: %s"),
                    progname, PQresultErrorMessage(res));
+           PQclear(res);
            goto error;
        }
    }
@@ -925,6 +929,7 @@ HandleCopyStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
                        PQclear(res);
                        goto error;
                    }
+                   PQclear(res);
                    res = PQgetResult(conn);
                }
                still_sending = false;