Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
app-admin/collectd: Rev bump to fix a memory leak in bind plugin
See collectd/collectd#2303 Package-Manager: Portage-2.3.5, Repoman-2.3.2
- Loading branch information
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
From fd01cdd0546ccbbda7f4cf5db2d0ae28e1e770cd Mon Sep 17 00:00:00 2001 | ||
From: Ruben Kerkhof <ruben@rubenkerkhof.com> | ||
Date: Tue, 30 May 2017 17:25:17 +0200 | ||
Subject: [PATCH] Bind plugin: plug a few leaks | ||
|
||
Fixes: #2303 | ||
--- | ||
src/bind.c | 10 ++++++++-- | ||
1 file changed, 8 insertions(+), 2 deletions(-) | ||
|
||
diff --git a/src/bind.c b/src/bind.c | ||
index 4860f1b604..853b9c26a3 100644 | ||
--- a/src/bind.c | ||
+++ b/src/bind.c | ||
@@ -526,8 +526,10 @@ static int bind_parse_generic_name_value(const char *xpath_expression, /* {{{ */ | ||
status = bind_xml_read_gauge(doc, counter, &value.gauge); | ||
else | ||
status = bind_xml_read_derive(doc, counter, &value.derive); | ||
- if (status != 0) | ||
+ if (status != 0) { | ||
+ xmlFree(name); | ||
continue; | ||
+ } | ||
|
||
status = (*list_callback)(name, value, current_time, user_data); | ||
if (status == 0) | ||
@@ -659,12 +661,16 @@ static int bind_parse_generic_name_attr_value_list( | ||
status = bind_xml_read_gauge(doc, child, &value.gauge); | ||
else | ||
status = bind_xml_read_derive(doc, child, &value.derive); | ||
- if (status != 0) | ||
+ if (status != 0) { | ||
+ xmlFree(attr_name); | ||
continue; | ||
+ } | ||
|
||
status = (*list_callback)(attr_name, value, current_time, user_data); | ||
if (status == 0) | ||
num_entries++; | ||
+ | ||
+ xmlFree(attr_name); | ||
} | ||
} | ||
|