From 2dc2d5d5a7b11115441ac3f4ace1c4bea83bb915 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sun, 21 Apr 2013 18:28:01 +0200 Subject: [PATCH] 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 --- src/write_riemann.c | 7 +++++++ 1 file changed, 7 insertions(+) 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 */ -- 2.11.0