From: SourceForge.net <no...@so...> - 2011-05-23 20:23:37
|
Patches item #3306476, was opened at 2011-05-23 15:23 Message generated for change (Tracker Item Submitted) made by tinypyramids You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312694&aid=3306476&group_id=12694 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Zachary Mark (tinypyramids) Assigned to: Nobody/Anonymous (nobody) Summary: fix memory leak in netsnmp_arch_swrun_container_load Initial Comment: The attached patch fixes a memory leak problem in the netsnmp_arch_swrun_container_load method of swrun_procfs_status.c where a swrun_entry is malloced but never freed in certain error conditions. On error, the loop continues without freeing the swrun_entry and a new one is malloced on the next iteration, resulting in a memory leak. On some systems I was using, the leak was as high as 20MB/day, which would bring systems with relatively low memory and long uptimes to a screeching halt. The patch calls netsnmp_swrun_entry_free before each continue call to free this memory. This applies against version 5.6.1 and is likely applicable to other previous versions as well. Valgrind report: ==11376== 40,331,520 bytes in 112,032 blocks are definitely lost in loss record 97 of 97 ==11376== at 0x4C1FB32: calloc (vg_replace_malloc.c:279) ==11376== by 0x50C0891: netsnmp_swrun_entry_create (swrun.c:283) ==11376== by 0x5100142: netsnmp_arch_swrun_container_load (swrun_procfs_status.c:71) ==11376== by 0x50C0E83: netsnmp_swrun_container_load (swrun.c:201) ==11376== by 0x50C1021: _cache_load (swrun.c:117) ==11376== by 0x4E60453: _cache_load (cache_handler.c:624) ==11376== by 0x4E61258: netsnmp_cache_helper_handler (cache_handler.c:566) ==11376== by 0x4E3ADBD: netsnmp_call_next_handler (agent_handler.c:522) ==11376== by 0x4E68B99: table_helper_handler (table.c:657) ==11376== by 0x4E3ADBD: netsnmp_call_next_handler (agent_handler.c:522) ==11376== by 0x4E60010: netsnmp_bulk_to_next_helper (bulk_to_next.c:110) ==11376== by 0x4E3A626: netsnmp_call_handlers (agent_handler.c:522) ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=312694&aid=3306476&group_id=12694 |