From: Florian Forster Date: Wed, 28 Sep 2016 19:23:49 +0000 (+0200) Subject: src/daemons/plugin.c: Don't modify user_data_t* in plugin_register_flush(). X-Git-Tag: collectd-5.6.1~4 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=38b9a40f8d93809723254db9278ed9a9febb25e2;p=collectd.git src/daemons/plugin.c: Don't modify user_data_t* in plugin_register_flush(). Fixes: #1954 --- diff --git a/src/daemon/plugin.c b/src/daemon/plugin.c index c6efc3fe..d6cf877a 100644 --- a/src/daemon/plugin.c +++ b/src/daemon/plugin.c @@ -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)