From 0c798317df52ec396b4e70b610252bc73f343a87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radek=20Vok=C3=A1l?= Date: Tue, 12 Dec 2006 10:17:00 +0000 Subject: [PATCH] - fix memleaks in ip-addr and tcpConn --- net-snmp-5.4-ip-addr-route-leaks.patch | 86 ++++++++++++++++++++++++++ net-snmp-5.4-tcpConn-tcp6-fopen.patch | 20 ++++++ net-snmp.spec | 11 +++- 3 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 net-snmp-5.4-ip-addr-route-leaks.patch create mode 100644 net-snmp-5.4-tcpConn-tcp6-fopen.patch diff --git a/net-snmp-5.4-ip-addr-route-leaks.patch b/net-snmp-5.4-ip-addr-route-leaks.patch new file mode 100644 index 0000000..490eb75 --- /dev/null +++ b/net-snmp-5.4-ip-addr-route-leaks.patch @@ -0,0 +1,86 @@ +Index: agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.c +=================================================================== +RCS file: /cvsroot/net-snmp/net-snmp/agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.c,v +retrieving revision 1.17 +retrieving revision 1.18 +diff -u -p -r1.17 -r1.18 +--- agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.c 25 Jan 2006 16:25:56 -0000 1.17 ++++ agent/mibgroup/ip-mib/ipAddressTable/ipAddressTable.c 6 Dec 2006 15:10:40 -0000 1.18 +@@ -2,7 +2,7 @@ + * Note: this file originally auto-generated by mib2c using + * version : 1.48 $ of : mfd-top.m2c,v $ + * +- * $Id: ipAddressTable.c,v 1.17 2006/01/25 16:25:56 dts12 Exp $ ++ * $Id: ipAddressTable.c,v 1.18 2006/12/06 15:10:40 rstory Exp $ + */ + /** \page MFD helper for ipAddressTable + * +@@ -156,6 +156,10 @@ ipAddressTable_rowreq_ctx_cleanup(ipAddr + /* + * TODO:211:o: |-> Perform extra ipAddressTable rowreq cleanup. + */ ++ if (NULL != rowreq_ctx->data) { ++ ipAddressTable_release_data(rowreq_ctx->data); ++ rowreq_ctx->data = NULL; ++ } + } /* ipAddressTable_rowreq_ctx_cleanup */ + + /** +Index: agent/mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable.c +=================================================================== +RCS file: /cvsroot/net-snmp/net-snmp/agent/mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable.c,v +retrieving revision 1.12 +retrieving revision 1.13 +diff -u -p -r1.12 -r1.13 +--- agent/mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable.c 12 Jun 2006 20:05:20 -0000 1.12 ++++ agent/mibgroup/ip-forward-mib/inetCidrRouteTable/inetCidrRouteTable.c 6 Dec 2006 15:01:26 -0000 1.13 +@@ -2,7 +2,7 @@ + * Note: this file originally auto-generated by mib2c using + * version : 1.48 $ of : mfd-top.m2c,v $ + * +- * $Id: inetCidrRouteTable.c,v 1.12 2006/06/12 20:05:20 rstory Exp $ ++ * $Id: inetCidrRouteTable.c,v 1.13 2006/12/06 15:01:26 rstory Exp $ + */ + /** \page MFD helper for inetCidrRouteTable + * +@@ -205,6 +205,10 @@ inetCidrRouteTable_rowreq_ctx_cleanup(in + /* + * TODO:211:o: |-> Perform extra inetCidrRouteTable rowreq cleanup. + */ ++ if (NULL != rowreq_ctx->data) { ++ inetCidrRouteTable_release_data(rowreq_ctx->data); ++ rowreq_ctx->data = NULL; ++ } + } /* inetCidrRouteTable_rowreq_ctx_cleanup */ + + /** +Index: agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable.c +=================================================================== +RCS file: /cvsroot/net-snmp/net-snmp/agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable.c,v +retrieving revision 1.11 +retrieving revision 1.12 +diff -u -p -r1.11 -r1.12 +--- agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable.c 25 Jan 2006 16:25:54 -0000 1.11 ++++ agent/mibgroup/ip-forward-mib/ipCidrRouteTable/ipCidrRouteTable.c 6 Dec 2006 15:01:26 -0000 1.12 +@@ -2,7 +2,7 @@ + * Note: this file originally auto-generated by mib2c using + * version : 1.48 $ of : mfd-top.m2c,v $ + * +- * $Id: ipCidrRouteTable.c,v 1.11 2006/01/25 16:25:54 dts12 Exp $ ++ * $Id: ipCidrRouteTable.c,v 1.12 2006/12/06 15:01:26 rstory Exp $ + */ + /** \page MFD helper for ipCidrRouteTable + * +@@ -160,6 +160,10 @@ ipCidrRouteTable_rowreq_ctx_cleanup(ipCi + /* + * TODO:211:o: |-> Perform extra ipCidrRouteTable rowreq cleanup. + */ ++ if (NULL != rowreq_ctx->data) { ++ ipCidrRouteTable_release_data(rowreq_ctx->data); ++ rowreq_ctx->data = NULL; ++ } + } /* ipCidrRouteTable_rowreq_ctx_cleanup */ + + /** + + diff --git a/net-snmp-5.4-tcpConn-tcp6-fopen.patch b/net-snmp-5.4-tcpConn-tcp6-fopen.patch new file mode 100644 index 0000000..acd1f6e --- /dev/null +++ b/net-snmp-5.4-tcpConn-tcp6-fopen.patch @@ -0,0 +1,20 @@ +--- net-snmp-5.4/agent/mibgroup/tcp-mib/data_access/tcpConn_linux.c.old 2006-12-08 15:29:56.000000000 +0200 ++++ net-snmp-5.4/agent/mibgroup/tcp-mib/data_access/tcpConn_linux.c 2006-12-08 15:30:39.000000000 +0200 +@@ -275,15 +275,6 @@ + if (0 == log_open_err) + log_open_err = 1; + +- netsnmp_assert(NULL != container); +- +-#undef PROCFILE +-#define PROCFILE "/proc/net/tcp6" +- if (!(in = fopen(PROCFILE, "r"))) { +- snmp_log(LOG_ERR,"could not open " PROCFILE "\n"); +- return -2; +- } +- + fgets(line, sizeof(line), in); /* skip header */ + + /* + + diff --git a/net-snmp.spec b/net-snmp.spec index 0a7d815..6f73f25 100644 --- a/net-snmp.spec +++ b/net-snmp.spec @@ -7,7 +7,7 @@ Summary: A collection of SNMP protocol tools and libraries Name: net-snmp Version: %{major_ver} -Release: 4%{?dist} +Release: 5%{?dist} Epoch: 1 License: BSDish @@ -32,6 +32,8 @@ Patch7: net-snmp-5.2.1-file_offset.patch Patch8: net-snmp-5.3.1-multilib.patch Patch9: net-snmp-5.4-config_libdir.patch Patch10: net-snmp-5.4-if_addr.patch +Patch11: net-snmp-5.4-ip-addr-route-leaks.patch +Patch12: net-snmp-5.4-tcpConn-tcp6-fopen.patch Requires(pre): /sbin/chkconfig Obsoletes: ucd-snmp @@ -137,6 +139,10 @@ and applications. %patch9 -p1 -b .libdir %patch10 -p1 -b .if_addr +#in net-snmp 5.4.1 +%patch11 -p0 -b .route-leak +%patch12 -p1 -b .tcp6-fopen + # Do this patch with a perl hack... perl -pi -e "s|'\\\$install_libdir'|'%{_libdir}'|" ltmain.sh @@ -347,6 +353,9 @@ rm -rf ${RPM_BUILD_ROOT} %{_libdir}/lib*.so.* %changelog +* Tue Dec 12 2006 Radek Vokál - 5.4-5 +- fix memleaks in ip-addr and tcpConn + * Thu Dec 7 2006 Radek Vokál - 5.4-4 - fix rtnetlink.h/if_addr.h