Package: collectd
Version: 5.1.0-3
Severity: important
Tags: patch

Dear Maintainer,

When using the mysql plugin, if the queries it polls from the mysql server do 
not return results, then memory is leaked.

This was fixed upstream in https://github.com/collectd/collectd/pull/263 during 
the wheezy freeze.

-- System Information:
Debian Release: 7.8
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-4-amd64 (SMP w/1 CPU core)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages collectd depends on:
ii  collectd-core  5.1.0-3
ii  iptables       1.4.14-3.1
ii  libc6          2.13-38+deb7u6
ii  librrd4        1.4.7-2

Versions of packages collectd recommends:
ii  libc6               2.13-38+deb7u6
ii  libcurl3-gnutls     7.26.0-1+wheezy12
ii  libdbi1             0.8.4-6
ii  libdbus-1-3         1.6.8-1+deb7u5
ii  libesmtp6           1.0.6-1+b1
ii  libgcrypt11         1.5.0-5+deb7u2
ii  libgdk-pixbuf2.0-0  2.26.1-1
ii  libglib2.0-0        2.33.12+really2.32.4-5
ii  libhal1             0.5.14-8
ii  libmemcached10      1.0.8-1
ii  libmodbus5          3.0.3-1
ii  libmysqlclient18    5.5.40-0+wheezy1
ii  libnotify4          0.7.5-1
ii  libopenipmi0        2.0.16-1.3
ii  liboping0           1.6.2-1
ii  libpcap0.8          1.3.0-1
ii  libperl5.14         5.14.2-21+deb7u2
ii  libpq5              9.1.14-0+deb7u1
ii  libprotobuf-c0      0.14-1+b1
ii  libpython2.7        2.7.3-6+deb7u2
ii  librabbitmq0        0.0.1.hg216-1
ii  librrd4             1.4.7-2
ii  libsensors4         1:3.3.2-2+deb7u1
ii  libsnmp15           5.4.3~dfsg-2.8+deb7u1
ii  libssl1.0.0         1.0.1e-2+deb7u14
ii  libtokyotyrant3     1.1.40-4.1+b1
ii  libupsclient1       2.6.4-2.3+deb7u1
ii  libvarnishapi1      3.0.2-2+deb7u1
ii  libvirt0            0.9.12.3-1+deb7u1
ii  libxml2             2.8.0+dfsg1-7+wheezy2
ii  libyajl2            2.0.4-2

collectd suggests no packages.

-- Configuration Files:
/etc/collectd/collectd.conf changed [not included]

-- no debconf information
#! /bin/sh /usr/share/dpatch/dpatch-run
## mysql_memory_leak.dpatch
##
## DP: Taken from upstream git repo:
## DP:
## DP: commit 61f60a27181027b73181dcb805ce319335a64fb2
## DP: Author: Tomas Doran <tomas.do...@timgroup.com>
## DP: Date:   Tue Feb 26 12:43:21 2013 +0000
## DP: 
## DP:     Fix memory leaks when plugin gets no results
## DP:     
## DP:     Signed-off-by: Florian Forster <o...@collectd.org>
## DP: 

@DPATCH@

diff --git a/src/mysql.c b/src/mysql.c
index 69df7c7..6f9efe3 100644
--- a/src/mysql.c
+++ b/src/mysql.c
@@ -557,6 +557,7 @@ static int mysql_read_master_stats (mysql_database_t *db, MYSQL *con)
 	{
 		ERROR ("mysql plugin: Failed to get master statistics: "
 				"`%s' did not return any rows.", query);
+		mysql_free_result (res);
 		return (-1);
 	}
 
@@ -565,6 +566,7 @@ static int mysql_read_master_stats (mysql_database_t *db, MYSQL *con)
 	{
 		ERROR ("mysql plugin: Failed to get master statistics: "
 				"`%s' returned less than two columns.", query);
+		mysql_free_result (res);
 		return (-1);
 	}
 
@@ -608,6 +610,7 @@ static int mysql_read_slave_stats (mysql_database_t *db, MYSQL *con)
 	{
 		ERROR ("mysql plugin: Failed to get slave statistics: "
 				"`%s' did not return any rows.", query);
+		mysql_free_result (res);
 		return (-1);
 	}
 
@@ -616,6 +619,7 @@ static int mysql_read_slave_stats (mysql_database_t *db, MYSQL *con)
 	{
 		ERROR ("mysql plugin: Failed to get slave statistics: "
 				"`%s' returned less than 33 columns.", query);
+		mysql_free_result (res);
 		return (-1);
 	}
 

Reply via email to