561875 - Leak of FD in rmon-mib Source: upstream, SVN rev. 18101 Index: net-snmp/agent/mibgroup/etherlike-mib/dot3StatsTable/dot3StatsTable_data_access.c =================================================================== --- net-snmp/agent/mibgroup/etherlike-mib/dot3StatsTable/dot3StatsTable_data_access.c (revision 18100) +++ net-snmp/agent/mibgroup/etherlike-mib/dot3StatsTable/dot3StatsTable_data_access.c (working copy) @@ -260,6 +260,7 @@ if (!list_head) { snmp_log (LOG_ERR, "access:dot3StatsTable, error getting the interface names present in the system\n"); DEBUGMSGTL(("access:dot3StatsTable", "error getting the interface names present in the system")); + close(fd); return MFD_ERROR; } @@ -288,6 +289,7 @@ rowreq_ctx = dot3StatsTable_allocate_rowreq_ctx(NULL); if (NULL == rowreq_ctx) { snmp_log(LOG_ERR, "memory allocation for dot3StatsTable failed\n"); + close(fd); return MFD_RESOURCE_UNAVAILABLE; } @@ -339,6 +341,8 @@ ++count; } + close(fd); + /* * free the interface names list */ Index: net-snmp/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_data_access.c =================================================================== --- net-snmp/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_data_access.c (revision 18100) +++ net-snmp/agent/mibgroup/rmon-mib/etherStatsTable/etherStatsTable_data_access.c (working copy) @@ -249,6 +249,7 @@ if (!list_head) { snmp_log (LOG_ERR, "access:etherStatsTable, error getting the interface names present in the system\n"); DEBUGMSGTL(("access:etherStatsTable", "error getting the interface names present in the system")); + close(fd); return MFD_ERROR; } @@ -277,6 +278,7 @@ rowreq_ctx = etherStatsTable_allocate_rowreq_ctx(NULL); if (NULL == rowreq_ctx) { snmp_log(LOG_ERR, "memory allocation failed\n"); + close(fd); return MFD_RESOURCE_UNAVAILABLE; } @@ -320,6 +322,8 @@ ++count; } + close(fd); + /* * free the interface names list */