pgpool2.git / summary / log / commit / refs

commit    fc1b8960ddee33793496ef4aa92ec3fc1d9dd0ad
Author:   Muhammad Usama <m.usama@gmail.com>
Date:     Fri Sep 09 18:34:30 2016 +0000

    Memory leak fix
    
    Per Coverity CID 1355044


src/config/pool_config_variables.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/config/pool_config_variables.c b/src/config/pool_config_variables.c index 3748786ef..4dcdb7595 100644 --- a/src/config/pool_config_variables.c +++ b/src/config/pool_config_variables.c @@ -3157,10 +3157,14 @@ static bool BackendFlagsAssignFunc (ConfigContext context, char* newval, int ind for (i=0;i<n;i++) { + int k; if (!strcmp(flags[i], "ALLOW_TO_FAILOVER")) { if (disallow_to_failover_is_specified) { + for (k = i; k < n; k++) + pfree(flags[k]); + pfree(flags); ereport(elevel, (errmsg("invalid configuration for key \"backend_flag%d\"",index), errdetail("cannot set ALLOW_TO_FAILOVER and DISALLOW_TO_FAILOVER at the same time"))); @@ -3175,6 +3179,10 @@ static bool BackendFlagsAssignFunc (ConfigContext context, char* newval, int ind { if (allow_to_failover_is_specified) { + for (k = i; k < n; k++) + pfree(flags[k]); + pfree(flags); + ereport(elevel, (errmsg("invalid configuration for key \"backend_flag%d\"",index), errdetail("cannot set ALLOW_TO_FAILOVER and DISALLOW_TO_FAILOVER at the same time"))); @@ -3189,9 +3197,12 @@ static bool BackendFlagsAssignFunc (ConfigContext context, char* newval, int ind ereport(elevel, (errmsg("invalid configuration for key \"backend_flag%d\"",index), errdetail("unknown backend flag:%s", flags[i]))); + for (k = i; k < n; k++) + pfree(flags[k]); pfree(flags); return false; } + pfree(flags[i]); } g_pool_config.backend_desc->backend_info[index].flag = flag; [parent: 9a2c2302b380]