From 0ca903cb167fbe58abe5cc9ef746613df1068d05 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Tue, 21 Jan 2014 10:30:36 +0100 Subject: [PATCH] Global variables should be initialized to zero. --- include/smpi/smpi_cocci.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/smpi/smpi_cocci.h b/include/smpi/smpi_cocci.h index 8243e7ac3e..c4ea46fdbf 100644 --- a/include/smpi/smpi_cocci.h +++ b/include/smpi/smpi_cocci.h @@ -15,7 +15,7 @@ type *name = NULL; \ static void __attribute__((constructor)) __preinit_##name(void) { \ if(!name) \ - name = (type*)malloc(smpi_global_size() * sizeof(type)); \ + name = (type*)calloc(smpi_global_size(), sizeof(type)); \ } \ static void __attribute__((destructor)) __postfini_##name(void) { \ free(name); \ @@ -55,7 +55,7 @@ XBT_PUBLIC(void) smpi_free_static(void); #define SMPI_VARINIT_STATIC(name,type) \ static type *name = NULL; \ if(!name) { \ - name = (type*)malloc(smpi_global_size() * sizeof(type)); \ + name = (type*)calloc(smpi_global_size(), sizeof(type)); \ smpi_register_static(name, xbt_free); \ } -- 2.20.1