From 532e2aa218d41b0064131e57825d7e4f9c2e1529 Mon Sep 17 00:00:00 2001 From: congzhou2603 Date: Mon, 23 Sep 2024 15:04:34 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90bugfix=E3=80=91=E4=BF=AE=E5=A4=8Dgs=5F?= =?UTF-8?q?increment=5Fbuild=E9=83=A8=E5=88=86=E5=86=85=E5=AD=98=E6=B3=84?= =?UTF-8?q?=E6=BC=8F=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/bin/pg_rewind/fetch.cpp | 5 +++++ src/bin/pg_rewind/parsexlog.cpp | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/bin/pg_rewind/fetch.cpp b/src/bin/pg_rewind/fetch.cpp index 233a70b39..14b157395 100755 --- a/src/bin/pg_rewind/fetch.cpp +++ b/src/bin/pg_rewind/fetch.cpp @@ -396,10 +396,13 @@ static BuildErrorCode receiveFileChunks(const char* sql, FILE* file) switch (PQresultStatus(res)) { case PGRES_SINGLE_TUPLE: + PQclear(res); + res = nullptr; break; case PGRES_TUPLES_OK: PQclear(res); + res = nullptr; continue; /* final zero-row result */ default: @@ -500,6 +503,8 @@ static BuildErrorCode receiveFileChunks(const char* sql, FILE* file) FetchCompressedFile(chunk, (uint32)chunkoff, (int32)chunkspace, (uint16)chunkSize, (uint8)algorithm); } PG_CHECKBUILD_AND_FREE_PGRESULT_RETURN(res); + PQclear(res); + res = nullptr; } g_progressFlag = true; diff --git a/src/bin/pg_rewind/parsexlog.cpp b/src/bin/pg_rewind/parsexlog.cpp index f53205174..cd44c20ab 100644 --- a/src/bin/pg_rewind/parsexlog.cpp +++ b/src/bin/pg_rewind/parsexlog.cpp @@ -733,9 +733,11 @@ bool CheckIfEanbedSaveSlots() if ((strcmp(optvalue, "1") == 0) || (strcmp(optvalue, "true") == 0) || (strcmp(optvalue, "on") == 0)) { pg_log(PG_PROGRESS, _("Enable saving confirmed_lsn in target %s\n"), config_file); freefile(optlines); + optlines = nullptr; return true; } } freefile(optlines); + optlines = nullptr; return false; }