diff options
author | Takuma Hoshiai | 2024-03-20 16:41:52 +0000 |
---|---|---|
committer | Takuma Hoshiai | 2024-03-20 16:41:52 +0000 |
commit | 25d05e55e6ebf334e768a9b454ecdb84a8a4054d (patch) | |
tree | 3f4cda0a1c874e93c721b2cad2255b6add8ff629 /src | |
parent | 475f290ffe20958aa54d68d85e43906f94db0207 (diff) |
Fix memory leak pointed out by Coverity.
Diffstat (limited to 'src')
-rw-r--r-- | src/config/pool_config.l | 8 |
1 files changed, 6 insertions, 2 deletions
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; |