From: Takuma Hoshiai Date: Wed, 20 Mar 2024 16:42:19 +0000 (+0900) Subject: Fix memory leak pointed out by Coverity. X-Git-Tag: V4_5_2~20 X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=d57d997aa5880b607089f34baa1d48dc838c5106;p=pgpool2.git Fix memory leak pointed out by Coverity. --- diff --git a/src/config/pool_config.l b/src/config/pool_config.l index 1cbe22ec7..c25b2e532 100644 --- a/src/config/pool_config.l +++ b/src/config/pool_config.l @@ -6,7 +6,7 @@ * pgpool: a language independent connection pool server for PostgreSQL * written by Tatsuo Ishii * - * Copyright (c) 2003-2016 PgPool Global Development Group + * Copyright (c) 2003-2024 PgPool Global Development Group * * Permission to use, copy, modify, and distribute this software and * its documentation for any purpose and without fee is hereby @@ -361,7 +361,9 @@ ParseConfigFile(const char *config_file, const char *calling_file, if (calling_file == NULL || is_absolute_path(config_file)) { /* absolute path is taken as-is */ - config_filepath = pstrdup(config_file); + config_filepath = (char *) palloc(strlen(config_file) + 1); + strcpy(config_filepath, config_file); + config_filepath[strlen(config_file)] = '\0'; } else { @@ -456,6 +458,8 @@ ParseConfigFile(const char *config_file, const char *calling_file, parse_error: + if (key) + pfree(key); fclose(fd); FreeConfigVariables(*head_p); *head_p = NULL;