[iftop] - Added patch to fix a memory leak in resolver.c (#782275, #861582) - Run autoreconf to recognize aa

Robert Scheck robert at fedoraproject.org
Thu Dec 19 19:00:16 UTC 2013


commit 4fa161fecb96931f582bcd064fbc9c570473df03
Author: Robert Scheck <robert at fedoraproject.org>
Date:   Thu Dec 19 20:00:06 2013 +0100

    - Added patch to fix a memory leak in resolver.c (#782275, #861582)
    - Run autoreconf to recognize aarch64 (#925579)
    - Added patch to fix needlessly caused assertion failure when using nss-myhostname (#839750, #847124, #868065, #961236, #1007434)

 iftop-1.0-memory-leak.patch    |   30 ++++++++++++++++++++++++++++++
 iftop-1.0-nss-myhostname.patch |   32 ++++++++++++++++++++++++++++++++
 iftop.spec                     |   16 ++++++++++++++--
 3 files changed, 76 insertions(+), 2 deletions(-)
---
diff --git a/iftop-1.0-memory-leak.patch b/iftop-1.0-memory-leak.patch
new file mode 100644
index 0000000..d46951a
--- /dev/null
+++ b/iftop-1.0-memory-leak.patch
@@ -0,0 +1,30 @@
+Patch by Olivier Allard-Jacquin <olivieraj at free.fr> for iftop <= 1.0pre2, which
+fixes a memory leak in resolver.c. The struct addr_storage was allocated but never
+freed if DNS resolution is turned off. For further information, please have a look
+to Debian bug ID #677141: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=677141 
+
+--- iftop-1.0pre2/resolver.c			2011-10-03 21:57:13.000000000 +0200
++++ iftop-1.0pre2/resolver.c.memory-leak	2013-11-16 13:41:21.000000000 +0100
+@@ -472,15 +472,15 @@
+     int added = 0;
+     struct addr_storage *raddr;
+ 
+-    raddr = malloc(sizeof *raddr);
+-    memset(raddr, 0, sizeof *raddr);
+-    raddr->af = af;
+-    raddr->len = (af == AF_INET ? sizeof(struct in_addr)
+-                  : sizeof(struct in6_addr));
+-    memcpy(&raddr->addr, addr, raddr->len);
+-
+     if(options.dnsresolution == 1) {
+ 
++        raddr = malloc(sizeof *raddr);
++        memset(raddr, 0, sizeof *raddr);
++        raddr->af = af;
++        raddr->len = (af == AF_INET ? sizeof(struct in_addr)
++                      : sizeof(struct in6_addr));
++        memcpy(&raddr->addr, addr, raddr->len);
++
+         pthread_mutex_lock(&resolver_queue_mutex);
+ 
+         if(hash_find(ns_hash, raddr, u_hostname.void_pp) == HASH_STATUS_OK) {
diff --git a/iftop-1.0-nss-myhostname.patch b/iftop-1.0-nss-myhostname.patch
new file mode 100644
index 0000000..dba62ba
--- /dev/null
+++ b/iftop-1.0-nss-myhostname.patch
@@ -0,0 +1,32 @@
+Patch by Robert Scheck <robert at fedoraproject.org> for iftop <= 1.0pre2 to avoid an
+assertion failure if an "invalid" (as in outside of IPv4 or IPv6) address family is
+passed to nss-myhostname's gethostbyaddr_r(). For further information please have a
+look to Red Hat Bugzilla IDs #839750, #847124, #868065, #961236 and #1007434:
+
+ - https://bugzilla.redhat.com/show_bug.cgi?id=839750
+ - https://bugzilla.redhat.com/show_bug.cgi?id=847124
+ - https://bugzilla.redhat.com/show_bug.cgi?id=868065
+ - https://bugzilla.redhat.com/show_bug.cgi?id=961236
+ - https://bugzilla.redhat.com/show_bug.cgi?id=1007434
+
+--- iftop-1.0pre2/resolver.c			2013-12-18 23:41:50.000000000 +0100
++++ iftop-1.0pre2/resolver.c.nss-myhostname	2013-12-18 23:51:25.000000000 +0100
+@@ -117,6 +117,10 @@
+     /* Allocate buffer, remember to free it to avoid memory leakage. */
+     tmphstbuf = xmalloc (hstbuflen);
+ 
++    /* nss-myhostname's gethostbyaddr_r() causes an assertion failure if an
++     * "invalid" (as in outside of IPv4 or IPv6) address family is passed */
++    if (addr->af == AF_INET || addr->af == AF_INET6) {
++
+     /* Some machines have gethostbyaddr_r returning an integer error code; on
+      * others, it returns a struct hostent*. */
+ #ifdef GETHOSTBYADDR_R_RETURNS_INT
+@@ -135,6 +139,7 @@
+         hstbuflen *= 2;
+         tmphstbuf = realloc (tmphstbuf, hstbuflen);
+       }
++    }
+ 
+     /*  Check for errors.  */
+     if (res || hp == NULL) {
diff --git a/iftop.spec b/iftop.spec
index b0ce19f..5d424a3 100644
--- a/iftop.spec
+++ b/iftop.spec
@@ -1,12 +1,15 @@
 Summary:	Command line tool that displays bandwidth usage on an interface
 Name:		iftop
 Version:	1.0
-Release:	0.5.pre2%{?dist}
+Release:	0.6.pre2%{?dist}
 License:	GPLv2+
 Group:		Applications/Internet
 URL:		http://www.ex-parrot.com/~pdw/%{name}/
 Source:		http://www.ex-parrot.com/~pdw/%{name}/download/%{name}-%{version}pre2.tar.gz
+Patch0:		iftop-1.0-memory-leak.patch
+Patch1:		iftop-1.0-nss-myhostname.patch
 BuildRequires:	ncurses-devel, %{_includedir}/pcap.h
+BuildRequires:	autoconf
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 %description
@@ -17,6 +20,9 @@ so slow?".
 
 %prep
 %setup -q -n %{name}-%{version}pre2
+%patch0 -p1 -b .memory-leak
+%patch1 -p1 -b .nss-myhostname
+autoconf
 
 %build
 %configure
@@ -36,6 +42,12 @@ rm -rf $RPM_BUILD_ROOT
 %{_mandir}/man8/%{name}.*
 
 %changelog
+* Thu Dec 19 2013 Robert Scheck <robert at fedoraproject.org> 1.0-0.6.pre2
+- Added patch to fix a memory leak in resolver.c (#782275, #861582)
+- Run autoreconf to recognize aarch64 (#925579)
+- Added patch to fix needlessly caused assertion failure when using
+  nss-myhostname (#839750, #847124, #868065, #961236, #1007434)
+
 * Sat Aug 03 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.0-0.5.pre2
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
 
@@ -108,7 +120,7 @@ rm -rf $RPM_BUILD_ROOT
 * Sat Oct 22 2005 Aurelien Bompard <gauret[AT]free.fr> 0.16-5
 - rebuild and add disttag
 
-* Fri Apr  7 2005 Michael Schwendt <mschwendt[AT]users.sf.net>
+* Thu Apr  7 2005 Michael Schwendt <mschwendt[AT]users.sf.net>
 - rebuilt
 
 * Fri Jun 04 2004 Aurelien Bompard <gauret[AT]free.fr> 0:0.16-0.fdr.3


More information about the scm-commits mailing list