fix the issue 'pg_recvlogical --plugin=XXX' run abnormal

解决pg_recvlogical --plugin=XXX不能执行的问题
复现条件:执行pg_recvlogical --plugin=test_encoding命令
问题原因:代码中plugin参数的变量类型为static const char*, 导致在进行该参数初始化时无法free掉
解决方案:plugin参数的变量类型修改为static char*
This commit is contained in:
chenc
2021-01-20 15:48:09 +08:00
parent 924550db38
commit febfca212b

View File

@ -49,7 +49,7 @@ static bool do_drop_slot = false;
static char** options;
static size_t noptions = 0;
static bool g_change_plugin = false;
static const char* plugin = "mppdb_decoding";
char* plugin = "mppdb_decoding";
/* Global State */
static int outfd = -1;
@ -710,7 +710,7 @@ static int getOptions(const int argc, char* const* argv)
break;
case 'P':
check_env_value_c(optarg);
if (plugin) {
if (g_change_plugin && plugin) {
pfree_ext(plugin);
}
plugin = pg_strdup(optarg);