Tweak newly added set_config_sourcefile() so that the target record
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 10 Sep 2008 19:16:22 +0000 (19:16 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 10 Sep 2008 19:16:22 +0000 (19:16 +0000)
isn't left corrupt if guc_strdup should fail.

src/backend/utils/misc/guc.c

index 4cc1ef3a94ef0c99a30fa1688bb05a2e1a4205d8..a33cc0e41cf3f72b1fb92edae9ce545eb079eec0 100644 (file)
@@ -10,7 +10,7 @@
  * Written by Peter Eisentraut <peter_e@gmx.net>.
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.471 2008/09/10 18:09:19 alvherre Exp $
+ *   $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.472 2008/09/10 19:16:22 tgl Exp $
  *
  *--------------------------------------------------------------------
  */
@@ -5128,9 +5128,10 @@ set_config_sourcefile(const char *name, char *sourcefile, int sourceline)
    if (record == NULL)
        elog(ERROR, "unrecognized configuration parameter \"%s\"", name);
 
+   sourcefile = guc_strdup(elevel, sourcefile);
    if (record->sourcefile)
        free(record->sourcefile);
-   record->sourcefile = guc_strdup(elevel, sourcefile);
+   record->sourcefile = sourcefile;
    record->sourceline = sourceline;
 }