summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5e8ca30)
raw | patch | inline | side by side (parent: 5e8ca30)
author | Sebastian Harl <sh@tokkee.org> | |
Wed, 17 Sep 2008 17:19:39 +0000 (19:19 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Wed, 17 Sep 2008 17:19:39 +0000 (19:19 +0200) |
Trivial upstream patch to fix a possible memory leak in the snmp plugin.
debian/changelog | patch | blob | history | |
debian/patches/00list | patch | blob | history | |
debian/patches/snmp_memleak.dpatch | [new file with mode: 0755] | patch | blob |
diff --git a/debian/changelog b/debian/changelog
index afc5acf5b068c5fa46e8838958a98dd77f44643d..8d8d8fbf0cf68ff32452cb449b55f3f3a4649acd 100644 (file)
--- a/debian/changelog
+++ b/debian/changelog
fix a typo in the libstatgrab code of the memory plugin.
* Added debian/patches/collectd_memleak.dpatch - trivial upstream patch to
fix a possible memory leak.
+ * Added debian/patches/snmp_memleak.dpatch - trivial upstream patch to fix a
+ possible memory leak in the snmp plugin.
- -- Sebastian Harl <sh@tokkee.org> Wed, 17 Sep 2008 10:28:36 +0200
+ -- Sebastian Harl <sh@tokkee.org> Wed, 17 Sep 2008 19:17:55 +0200
collectd (4.4.2-1) unstable; urgency=low
diff --git a/debian/patches/00list b/debian/patches/00list
index d2a82d98d7dcb5e4ef9db1b389fbde6470e3d70f..9b2db92184df6ebfe0b63fa4f1fa408ca5d140a6 100644 (file)
--- a/debian/patches/00list
+++ b/debian/patches/00list
myplugin_strcpy.dpatch
memory_libstatgrab.dpatch
collectd_memleak.dpatch
+snmp_memleak.dpatch
diff --git a/debian/patches/snmp_memleak.dpatch b/debian/patches/snmp_memleak.dpatch
--- /dev/null
@@ -0,0 +1,59 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## snmp_memleak.dpatch by Florian Forster <octo@noris.net>
+##
+## DP: Fix a possible memory leak in the snmp plugin: The SNMP result object
+## DP: was not freed when `csnmp_instance_list_add' failed.
+## DP: (This is upstream Git commit 0109e3c1f3a515ed716ddbdc261e0ed2e3f8e640)
+
+@DPATCH@
+
+diff a/src/snmp.c b/src/snmp.c
+--- a/src/snmp.c
++++ b/src/snmp.c
+@@ -1120,10 +1120,6 @@ static int csnmp_read_table (host_definition_t *host, data_definition_t *data)
+ vb = res->variables;
+ if (vb == NULL)
+ {
+- if (res != NULL)
+- snmp_free_pdu (res);
+- res = NULL;
+-
+ status = -1;
+ break;
+ }
+@@ -1132,10 +1128,7 @@ static int csnmp_read_table (host_definition_t *host, data_definition_t *data)
+ * subtree */
+ if (csnmp_check_res_left_subtree (host, data, res) != 0)
+ {
+- if (res != NULL)
+- snmp_free_pdu (res);
+- res = NULL;
+-
++ status = 0;
+ break;
+ }
+
+@@ -1157,11 +1150,7 @@ static int csnmp_read_table (host_definition_t *host, data_definition_t *data)
+ (vb != NULL) && (vb->next_variable != NULL);
+ vb = vb->next_variable)
+ /* do nothing */;
+- if (vb == NULL)
+- {
+- status = -1;
+- break;
+- }
++ assert (vb != NULL);
+
+ /* Copy OID to oid_list[data->values_len] */
+ memcpy (oid_list[data->values_len].oid, vb->name,
+@@ -1224,6 +1213,10 @@ static int csnmp_read_table (host_definition_t *host, data_definition_t *data)
+ res = NULL;
+ } /* while (status == 0) */
+
++ if (res != NULL)
++ snmp_free_pdu (res);
++ res = NULL;
++
+ if (status == 0)
+ csnmp_dispatch_table (host, data, instance_list, value_table);
+