Fix for Coverity warning '1395047 Resource leak'
authorMuhammad Usama <m.usama@gmail.com>
Thu, 3 Oct 2019 20:25:17 +0000 (01:25 +0500)
committerMuhammad Usama <m.usama@gmail.com>
Thu, 3 Oct 2019 20:25:17 +0000 (01:25 +0500)
src/config/pool_config_variables.c

index 1cdf3ed23663a2a310c0f62e614339eea67283dd..308f54a21132e01dbc574d8eaf9b60e139161efa 100644 (file)
@@ -2709,7 +2709,6 @@ get_list_from_string_regex_delim(const char *input, const char *delimi, int *n)
 {
 #ifndef POOL_PRIVATE
        int                     j = 0;
-       char       *output;
        char       *str;
        char       *buf,
                           *str_temp;
@@ -2746,12 +2745,12 @@ get_list_from_string_regex_delim(const char *input, const char *delimi, int *n)
                }
                else if (*str_temp == *delimi)
                {
-                       output = (char *) palloc(j + 1);
+                       char *output = (char *) palloc(j + 1);
                        StrNCpy(output, buf, j + 1);
 
                        /* replace escape character of "'" */
                        tokens[*n] = string_replace(output, "\\'", "'");
-
+                       pfree(output);
                        ereport(DEBUG3,
                                        (errmsg("initializing pool configuration"),
                                         errdetail("extracting string tokens [token[%d]: %s]", *n, tokens[*n])));