a patch for memory leak
Wei Zheng <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <1ED0DFECE1B2F44A88FF470416DB0A5108937CE3@SEAEMBX03.olympus.F5Net.com> |
When CONTAINER_INSERT fails in ipaddress_linux.c and systemstats_linux.c, there will be memory leak. Under certain system configuration, this memory leak can cause system reset. Here is a patch to prevent memory leak. (The patch is for 5.4.2.1. I know the leak exists in latest 5.6.) Thanks, Wei ------------------------------------------------------------------------------ Start uncovering the many advantages of virtual appliances and start using them to simplify application deployment and accelerate your shift to cloud computing. http://p.sf.net/sfu/novell-sfdev2dev _______________________________________________ Net-snmp-users mailing list [email protected] Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users
container_insert_mem_leak.patch
(application/octet-stream, 1.5 KB)
--- agent/mibgroup/ip-mib/data_access/ipaddress_linux.c 2008-08-13 06:02:12.000000000 -0700
+++ agent/mibgroup/ip-mib/data_access/ipaddress_linux.c 2010-09-17 14:02:40.000000000 -0700
@@ -325,7 +325,12 @@
/*
* add entry to container
*/
- CONTAINER_INSERT(container, entry);
+ if (CONTAINER_INSERT(container, entry) < 0)
+ {
+ DEBUGMSGTL(("access:ipaddress:container","error ipaddress_linux: insert into container failed.\n"));
+ netsnmp_access_ipaddress_entry_free(entry);
+ }
+
}
fclose(in);
--- agent/mibgroup/ip-mib/data_access/systemstats_linux.c 2006-09-14 17:48:50.000000000 -0700
+++ agent/mibgroup/ip-mib/data_access/systemstats_linux.c 2010-09-17 14:02:40.000000000 -0700
@@ -206,8 +206,13 @@
/*
* add to container
*/
- CONTAINER_INSERT(container, entry);
+ if (CONTAINER_INSERT(container, entry) < 0)
+ {
+ DEBUGMSGTL(("access:systemstats:container","error with systemstats_entry: insert into container failed.\n"));
+ netsnmp_access_systemstats_entry_free(entry);
+ }
}
+
return 0;
}
@@ -369,7 +374,12 @@
/*
* add to container
*/
- CONTAINER_INSERT(container, entry);
+ if (CONTAINER_INSERT(container, entry) < 0)
+ {
+ DEBUGMSGTL(("access:systemstats:container","error with systemstats_entry: insert into container failed.\n"));
+ netsnmp_access_systemstats_entry_free(entry);
+ }
+
return rc;
}