update src/bin/pg_probackup/pgut.cpp.

修复probackup内存泄露问题
This commit is contained in:
liyifeng_seu 2021-08-05 06:14:31 +00:00 committed by Gitee
parent d062205e8c
commit 4d100b9387
1 changed files with 10 additions and 0 deletions

View File

@ -613,6 +613,7 @@ PGconn* pgut_connect_replication(const char *host, const char *port,
const char **values;
errno_t rc = EOK;
char rwtimeoutStr[12] = {0};
const char *malloc_port = NULL;
if (interrupted && !in_cleanup)
elog(ERROR, "interrupted");
@ -659,6 +660,7 @@ PGconn* pgut_connect_replication(const char *host, const char *port,
{
keywords[i] = "port";
values[i] = inc_dbport(port);
malloc_port = values[i];
i++;
}
@ -683,6 +685,10 @@ PGconn* pgut_connect_replication(const char *host, const char *port,
{
free(values);
free(keywords);
if (malloc_port)
{
free((void *)malloc_port);
}
return tmpconn;
}
@ -700,6 +706,10 @@ PGconn* pgut_connect_replication(const char *host, const char *port,
PQfinish(tmpconn);
free(values);
free(keywords);
if (malloc_port)
{
free((void *)malloc_port);
}
return NULL;
}
}