fix several not tested malloc or calloc return value

This commit is contained in:
Laurent THOMAS
2025-09-09 18:04:26 +02:00
committed by Robert Schmidt
parent d372aa1b50
commit 278d2cbca1
13 changed files with 84 additions and 93 deletions
+5 -1
View File
@@ -300,12 +300,16 @@ configmodule_interface_t *load_configmodule(int argc,
cfgmode = strdup(CONFIG_LIBCONFIGFILE);
}
}
static configmodule_interface_t *cfgptr;
static configmodule_interface_t *cfgptr = NULL;
if (cfgptr)
fprintf(stderr, "ERROR: Call load_configmodule more than one time\n");
// The macros are not thread safe print_params and similar
cfgptr = calloc(sizeof(configmodule_interface_t), 1);
if (!cfgptr) {
fprintf(stderr, "ERROR: cannot allocate a memory for configuration\n");
return NULL;
}
/* argv_info is used to memorize command line options which have been recognized */
/* and to detect unrecognized command line options which might have been specified */
cfgptr->argv_info = calloc(sizeof(int32_t), argc+10);