From: Florian Forster Date: Sun, 21 Apr 2013 16:28:01 +0000 (+0200) Subject: write_riemann plugin: Fix a memory leak. X-Git-Tag: collectd-5.3.1~7 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2dc2d5d5a7b11115441ac3f4ace1c4bea83bb915;p=collectd.git write_riemann plugin: Fix a memory leak. Attributes were allocated and added to the event but not freed. D'oh! Thanks to @dch for reporting this! Github: #307 --- diff --git a/src/write_riemann.c b/src/write_riemann.c index d31a988e..b5242172 100644 --- a/src/write_riemann.c +++ b/src/write_riemann.c @@ -58,6 +58,8 @@ static size_t riemann_tags_num; static void riemann_event_protobuf_free (Event *event) /* {{{ */ { + size_t i; + if (event == NULL) return; @@ -70,6 +72,11 @@ static void riemann_event_protobuf_free (Event *event) /* {{{ */ event->tags = NULL; event->n_tags = 0; + for (i = 0; i < event->n_attributes; i++) + sfree (event->attributes[i]); + sfree (event->attributes); + event->n_attributes = 0; + sfree (event); } /* }}} void riemann_event_protobuf_free */