]> git.ipfire.org Git - thirdparty/collectd.git/commit
write_riemann plugin: use reference counting to when freeing user data.
authorFlorian Forster <octo@collectd.org>
Wed, 29 Nov 2023 12:41:32 +0000 (13:41 +0100)
committerFlorian Forster <octo@collectd.org>
Tue, 12 Dec 2023 09:51:32 +0000 (10:51 +0100)
commit30f7e7f461a524f61608776c7d9b370a52f11e70
tree5581f314ba45005bb16cdc1cd4ca6e498fb1be53
parentabb68f59613ae2eaee590f5a5f05de6bb9218ba1
write_riemann plugin: use reference counting to when freeing user data.

While reference counting was present previously, it had problems:

*   The reference passed to `plugin_register_flush()` was not counted.
*   If a flush plugin was registered, `free_func` was set to NULL but
    the reference passed to `plugin_register_notification()` was still
    counted, meaning in that case the counter never went to zero.
*   Mutexes must be unlocked when calling `pthread_mutex_destroy()`.
*   The code limped on after an error, returning a failure eventually.
    This is unnecessarily complex control flow that has been simplified.
src/write_riemann.c