X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fwrite_graphite.c;h=c264932f5e52ec71a4083fdfdf3be3b2652af074;hb=dbf45dbf4eab1d058c49fc3bfb8be3e2cba98234;hp=546111bb1ba998f2122d424b1d92a42de273609e;hpb=654c16012a34b19845ed1ac2a926b689ef939023;p=collectd.git diff --git a/src/write_graphite.c b/src/write_graphite.c index 546111bb..c264932f 100644 --- a/src/write_graphite.c +++ b/src/write_graphite.c @@ -456,6 +456,7 @@ static int wg_config_node (oconfig_item_t *ci) user_data_t user_data; char callback_name[DATA_MAX_NAME_LEN]; int i; + int status = 0; cb = malloc (sizeof (*cb)); if (cb == NULL) @@ -478,7 +479,7 @@ static int wg_config_node (oconfig_item_t *ci) /* FIXME: Legacy configuration syntax. */ if (strcasecmp ("Carbon", ci->key) != 0) { - int status = cf_util_get_string (ci, &cb->name); + status = cf_util_get_string (ci, &cb->name); if (status != 0) { wg_callback_free (cb); @@ -520,7 +521,17 @@ static int wg_config_node (oconfig_item_t *ci) { ERROR ("write_graphite plugin: Invalid configuration " "option: %s.", child->key); + status = -1; } + + if (status != 0) + break; + } + + if (status != 0) + { + wg_callback_free (cb); + return (status); } /* FIXME: Legacy configuration syntax. */