X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Fvirt.c;h=2a7162ec52bce7a0801d67bea25f20cd4584a99e;hp=443e5b434eb691944ceec74fdff4a2e9fd42017f;hb=b12fdf9baa747e059518078bf6073b5dc8bde957;hpb=464fcac76a086996126087314b72ca5881da09c9 diff --git a/src/virt.c b/src/virt.c index 443e5b43..2a7162ec 100644 --- a/src/virt.c +++ b/src/virt.c @@ -1155,6 +1155,11 @@ static int lv_init_ignorelists() { /* Validates config option that may take multiple strings arguments. * Returns 0 on success, -1 otherwise */ static int check_config_multiple_string_entry(const oconfig_item_t *ci) { + if (ci == NULL) { + ERROR(PLUGIN_NAME " plugin: ci oconfig_item can't be NULL"); + return -1; + } + if (ci->values_num < 1) { ERROR(PLUGIN_NAME " plugin: the '%s' option requires at least one string argument", @@ -1312,8 +1317,10 @@ static int lv_config(oconfig_item_t *ci) { continue; } else if (strcasecmp(c->key, "HostnameFormat") == 0) { /* this option can take multiple strings arguments in one config line*/ - if (check_config_multiple_string_entry(c) != 0) + if (check_config_multiple_string_entry(c) != 0) { + ERROR(PLUGIN_NAME " plugin: Could not get 'HostnameFormat' parameter"); return -1; + } const int params_num = c->values_num; for (int i = 0; i < params_num; ++i) { @@ -1339,8 +1346,11 @@ static int lv_config(oconfig_item_t *ci) { continue; } else if (strcasecmp(c->key, "PluginInstanceFormat") == 0) { /* this option can handle list of string parameters in one line*/ - if (check_config_multiple_string_entry(c) != 0) + if (check_config_multiple_string_entry(c) != 0) { + ERROR(PLUGIN_NAME + " plugin: Could not get 'PluginInstanceFormat' parameter"); return -1; + } const int params_num = c->values_num; for (int i = 0; i < params_num; ++i) {