bdr: fix: use palloc0() instead of palloc()
authorChristian Kruse <[email protected]>
Tue, 22 Apr 2014 08:55:55 +0000 (10:55 +0200)
committerAndres Freund <[email protected]>
Thu, 3 Jul 2014 15:55:26 +0000 (17:55 +0200)
When using palloc(), bdr_startup_context->workers is not NULL/NIL and
therefore the later lcons() call will lead to a segfault.

contrib/bdr/bdr.c

index 355d20e4d4ebb24c016f9f575010352d2299bc08..501700fe78d39f1b57b4eb8ac1ea80bcde9ce665 100644 (file)
@@ -1359,7 +1359,7 @@ _PG_init(void)
    bdr_worker_alloc_shmem_segment();
 
    /* Prepare storage to pass data into our shared memory startup hook */
-   bdr_startup_context = (BdrStartupContext *) palloc(sizeof(BdrStartupContext));
+   bdr_startup_context = (BdrStartupContext *) palloc0(sizeof(BdrStartupContext));
 
    /* Names of all databases we're going to be doing BDR for */
    used_databases = palloc0(sizeof(char *) * list_length(connames));