Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd7fd22a

Browse files
committed
Fix memory leaks in pg_rewind. Several PQclear() calls were missing.
Originally reported by Vladimir Borodin in the pg_rewind github project,patch by Michael Paquier.
1 parent820d1ce commitd7fd22a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

‎src/bin/pg_rewind/libpq_fetch.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,8 @@ libpqGetFile(const char *filename, size_t *filesize)
350350
memcpy(result,PQgetvalue(res,0,0),len);
351351
result[len]='\0';
352352

353+
PQclear(res);
354+
353355
pg_log(PG_DEBUG,"fetched file \"%s\", length %d\n",filename,len);
354356

355357
if (filesize)
@@ -410,13 +412,15 @@ libpq_executeFileMap(filemap_t *map)
410412
if (PQresultStatus(res)!=PGRES_COMMAND_OK)
411413
pg_fatal("could not create temporary table: %s",
412414
PQresultErrorMessage(res));
415+
PQclear(res);
413416

414417
sql="COPY fetchchunks FROM STDIN";
415418
res=PQexec(conn,sql);
416419

417420
if (PQresultStatus(res)!=PGRES_COPY_IN)
418421
pg_fatal("could not send file list: %s",
419422
PQresultErrorMessage(res));
423+
PQclear(res);
420424

421425
for (i=0;i<map->narray;i++)
422426
{
@@ -464,6 +468,7 @@ libpq_executeFileMap(filemap_t *map)
464468
if (PQresultStatus(res)!=PGRES_COMMAND_OK)
465469
pg_fatal("unexpected result while sending file list: %s",
466470
PQresultErrorMessage(res));
471+
PQclear(res);
467472
}
468473

469474
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp