!1187 修复probackup内存泄露问题

Merge pull request !1187 from liyifeng_seu/master
This commit is contained in:
opengauss-bot
2021-08-05 07:29:14 +00:00
committed by Gitee
2 changed files with 12 additions and 0 deletions

View File

@ -804,6 +804,8 @@ int main(int argc, char *argv[])
*/
parse_backup_option_to_params(command, command_name);
pfree(command_name);
compress_init();
/* do actual operation */

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;
}
}