init_conf_str_vars in master_params.cpp has memory leak when master reload configure.

This commit is contained in:
zhengshuxin 2017-09-06 22:03:27 +08:00
parent 1a36ede275
commit 3d406e7277
2 changed files with 6 additions and 3 deletions

View File

@ -2,6 +2,8 @@
6) 2017.9.5
6.1) feature: master can wait children to exit with sync or async
6.2) feature: master can kill SIGTERM children when reloading
6.3) bugfix: master_params.cpp 中的 init_conf_str_vars 函数在 master reload 时
有内存泄露
5) 2017.8.11
5.1) safety: master can't fatal for some configure error of any app service.

View File

@ -92,12 +92,13 @@ static void init_conf_int_vars(ACL_CONFIG_INT_TABLE cit[])
static void init_conf_str_vars(ACL_CONFIG_STR_TABLE cst[])
{
int i;
static int first_call = 1;
for (i = 0; cst[i].name != 0; i++) {
/*
if (*(cst[i].target) != 0)
if (first_call)
first_call = 0;
else if (*(cst[i].target) != 0)
acl_myfree(*(cst[i].target));
*/
*(cst[i].target) = acl_mystrdup(cst[i].defval);
}
}