Code

src/daemons/plugin.c: Don't modify user_data_t* in plugin_register_flush().
authorFlorian Forster <octo@collectd.org>
Wed, 28 Sep 2016 19:23:49 +0000 (21:23 +0200)
committerFlorian Forster <octo@collectd.org>
Wed, 28 Sep 2016 19:23:49 +0000 (21:23 +0200)
Fixes: #1954
src/daemon/plugin.c

index c6efc3fe439b35ed396b22a391938e2af98c6e3c..d6cf877a387c7521a5e331a309f64375197aec17 100644 (file)
@@ -1394,15 +1394,15 @@ int plugin_register_flush (const char *name,
                }
                cb->timeout = ctx.flush_timeout;
 
-               ud->data = cb;
-               ud->free_func = plugin_flush_timeout_callback_free;
-
                status = plugin_register_complex_read (
                        /* group     = */ "flush",
                        /* name      = */ flush_name,
                        /* callback  = */ plugin_flush_timeout_callback,
                        /* interval  = */ ctx.flush_interval,
-                       /* user data = */ ud);
+                       /* user data = */ &(user_data_t) {
+                               .data = cb,
+                               .free_func = plugin_flush_timeout_callback_free,
+                       });
 
                sfree (flush_name);
                if (status != 0)