@@ -120,7 +120,6 @@ ProcessConfigFile(GucContext context)
120
120
*head,
121
121
*tail;
122
122
int i;
123
- char ConfigAutoFileName[MAXPGPATH];
124
123
char *ErrorConfFile;
125
124
char *CallingFileName;
126
125
@@ -155,17 +154,16 @@ ProcessConfigFile(GucContext context)
155
154
* data directory, however when called during initdb data directory is not
156
155
* set till this point, so use ConfigFile path which will be same.
157
156
*/
158
- snprintf(ConfigAutoFileName,sizeof(ConfigAutoFileName),"%s", PG_AUTOCONF_FILENAME);
159
157
if (data_directory)
160
158
CallingFileName = NULL;
161
159
else
162
160
CallingFileName = ConfigFileName;
163
161
164
- if (!ParseConfigFile(ConfigAutoFileName , CallingFileName, false, 0, elevel, &head, &tail))
162
+ if (!ParseConfigFile(PG_AUTOCONF_FILENAME , CallingFileName, false, 0, elevel, &head, &tail))
165
163
{
166
164
/* Syntax error(s) detected in the file, so bail out */
167
165
error = true;
168
- ErrorConfFile = ConfigAutoFileName ;
166
+ ErrorConfFile = PG_AUTOCONF_FILENAME ;
169
167
goto cleanup_list;
170
168
}
171
169
@@ -368,8 +366,6 @@ ProcessConfigFile(GucContext context)
368
366
PgReloadTime = GetCurrentTimestamp();
369
367
370
368
cleanup_list:
371
- FreeConfigVariables (head);
372
-
373
369
if (error)
374
370
{
375
371
/* During postmaster startup, any error is fatal */
@@ -389,6 +385,13 @@ ProcessConfigFile(GucContext context)
389
385
errmsg (" configuration file \" %s\" contains errors; no changes were applied" ,
390
386
ErrorConfFile)));
391
387
}
388
+
389
+ /*
390
+ * Calling FreeConfigVariables() any earlier than this can cause problems,
391
+ * because ErrorConfFile could be pointing to a string that will be freed
392
+ * here.
393
+ */
394
+ FreeConfigVariables (head);
392
395
}
393
396
394
397
/*
0 commit comments