Add missing PQclear() calls into pg_receivexlog.
authorFujii Masao <fujii@postgresql.org>
Sat, 2 Aug 2014 06:18:09 +0000 (15:18 +0900)
committerFujii Masao <fujii@postgresql.org>
Sat, 2 Aug 2014 06:19:35 +0000 (15:19 +0900)
Back-patch to 9.3.

src/bin/pg_basebackup/receivelog.c

index d57d293735b807f586f9fdbe5a0efd0dfef7c8fd..8f360ec3e4607003a85863d974b75832eb5d9bb6 100644 (file)
@@ -626,6 +626,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);
@@ -640,6 +641,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).
                         *
@@ -661,6 +664,7 @@ ReceiveXlogStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
                        fprintf(stderr,
                                        _("%s: unexpected termination of replication stream: %s"),
                                        progname, PQresultErrorMessage(res));
+                       PQclear(res);
                        goto error;
                }
        }
@@ -871,6 +875,7 @@ HandleCopyStream(PGconn *conn, XLogRecPtr startpos, uint32 timeline,
                                                PQclear(res);
                                                goto error;
                                        }
+                                       PQclear(res);
                                        res = PQgetResult(conn);
                                }
                                still_sending = false;