Hi all In some cases , PGresult is not cleared.
File: src\bin\pg_basebackup\streamutil.c bool RetrieveWalSegSize(PGconn *conn) { PGresult *res; ...... res = PQexec(conn, "SHOW wal_segment_size"); if (PQresultStatus(res) != PGRES_TUPLES_OK) { pg_log_error("could not send replication command \"%s\": %s", "SHOW wal_segment_size", PQerrorMessage(conn)); PQclear(res); // *** res is cleared *** return false; } ...... /* fetch xlog value and unit from the result */ if (sscanf(PQgetvalue(res, 0, 0), "%d%s", &xlog_val, xlog_unit) != 2) { pg_log_error("WAL segment size could not be parsed"); return false; // *** res is not cleared *** } ...... if (!IsValidWalSegSize(WalSegSz)) { pg_log_error(ngettext("WAL segment size must be a power of two between 1 MB and 1 GB, but the remote server reported a value of %d byte", "WAL segment size must be a power of two between 1 MB and 1 GB, but the remote server reported a value of %d bytes", WalSegSz), WalSegSz); return false; ; // *** res is not cleared *** } ...... Here is a patch. Best Regards!
pg_basebackup.patch
Description: pg_basebackup.patch