From: Florian Forster Date: Sat, 23 Mar 2013 08:53:28 +0000 (+0100) Subject: src/plugin.c: Assert that "data_sets" is non-NULL. X-Git-Tag: collectd-5.3.0~27 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=044cb79594f94632eedf24a7bbfb8e645691a6d3;p=collectd.git src/plugin.c: Assert that "data_sets" is non-NULL. Otherwise we might run into an assertion in the AVL tree. This can be triggered e.g. when calling plugin_get_ds() from within a config callback. --- diff --git a/src/plugin.c b/src/plugin.c index 453e896b..4c6a0322 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -2016,6 +2016,12 @@ const data_set_t *plugin_get_ds (const char *name) { data_set_t *ds; + if (data_sets == NULL) + { + ERROR ("plugin_get_ds: No data sets are defined yet."); + return (NULL); + } + if (c_avl_get (data_sets, name, (void *) &ds) != 0) { DEBUG ("No such dataset registered: %s", name);