@@ -120,7 +120,6 @@ ProcessConfigFile(GucContext context)
120120 *head,
121121 *tail;
122122inti;
123- charConfigAutoFileName[MAXPGPATH];
124123char*ErrorConfFile;
125124char*CallingFileName;
126125
@@ -155,17 +154,16 @@ ProcessConfigFile(GucContext context)
155154 * data directory, however when called during initdb data directory is not
156155 * set till this point, so use ConfigFile path which will be same.
157156 */
158- snprintf(ConfigAutoFileName,sizeof(ConfigAutoFileName),"%s", PG_AUTOCONF_FILENAME);
159157if (data_directory)
160158CallingFileName = NULL;
161159else
162160CallingFileName = ConfigFileName;
163161
164- if (!ParseConfigFile(ConfigAutoFileName , CallingFileName, false, 0, elevel, &head, &tail))
162+ if (!ParseConfigFile(PG_AUTOCONF_FILENAME , CallingFileName, false, 0, elevel, &head, &tail))
165163{
166164/* Syntax error(s) detected in the file, so bail out */
167165error = true;
168- ErrorConfFile =ConfigAutoFileName ;
166+ ErrorConfFile =PG_AUTOCONF_FILENAME ;
169167goto cleanup_list;
170168}
171169
@@ -368,8 +366,6 @@ ProcessConfigFile(GucContext context)
368366PgReloadTime = GetCurrentTimestamp();
369367
370368 cleanup_list:
371- FreeConfigVariables (head);
372-
373369if (error)
374370{
375371/* During postmaster startup, any error is fatal */
@@ -389,6 +385,13 @@ ProcessConfigFile(GucContext context)
389385errmsg (" configuration file\" %s\" contains errors; no changes were applied" ,
390386ErrorConfFile)));
391387}
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);
392395}
393396
394397/*