Prevent 'undefined allocation of 0 bytes'

This commit is contained in:
twinaphex 2016-09-22 21:59:37 +02:00
parent 7fdc38bf30
commit 3e066165e5

View File

@ -175,6 +175,9 @@ core_option_manager_t *core_option_manager_new(const char *conf_path,
for (var = vars; var->key && var->value; var++)
size++;
if (size == 0)
goto error;
opt->opts = (struct core_option*)calloc(size, sizeof(*opt->opts));
if (!opt->opts)
goto error;