Fix crash when reading 'timezone = unknown' from postgresql.conf during
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 8 Aug 2005 23:39:14 +0000 (23:39 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 8 Aug 2005 23:39:14 +0000 (23:39 +0000)
SIGHUP; it's not OK for an assign_hook to return a non-malloc'd string.
Problem was introduced during timezone library rewrite.

src/backend/commands/variable.c

index a7c2731819d4209470295866957cde495e9c6ffc..30173e4cabd83840375a68a6efeca7b19f253682 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/commands/variable.c,v 1.105.4.1 2005/06/05 01:48:45 tgl Exp $
+ *   $PostgreSQL: pgsql/src/backend/commands/variable.c,v 1.105.4.2 2005/08/08 23:39:14 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -325,10 +325,13 @@ assign_timezone(const char *value, bool doit, GucSource source)
             * pg_timezone_initialize() will eventually select a default
             * value from the environment.
             */
-           const char *curzone = pg_get_current_timezone();
+           if (doit)
+           {
+               const char *curzone = pg_get_current_timezone();
 
-           if (curzone)
-               value = curzone;
+               if (curzone)
+                   value = curzone;
+           }
        }
        else
        {