458009 - [5.3] Possible FD leak in the var_hrswrun() of net-snmp-5.3.1-24.el5. Source: Bugzilla (patch from customer) Reviewed-By: Jan Safranek <jsafrane@redhat.com> diff -up net-snmp-5.3.2.2/agent/mibgroup/host/hr_swrun.c.fd-leak net-snmp-5.3.2.2/agent/mibgroup/host/hr_swrun.c --- net-snmp-5.3.2.2/agent/mibgroup/host/hr_swrun.c.fd-leak 2008-08-12 10:40:48.000000000 +0200 +++ net-snmp-5.3.2.2/agent/mibgroup/host/hr_swrun.c 2008-08-12 10:43:45.000000000 +0200 @@ -725,11 +725,15 @@ var_hrswrun(struct variable * vp, if ((fp = fopen(string, "r")) == NULL) return NULL; cp = fgets(buf, sizeof(buf), fp); /* Name: process name */ - if (cp == NULL) + if (cp == NULL) { + fclose(fp); return NULL; /* the process probably died*/ + } cp = strchr(buf, ':'); - if ( cp == NULL ) + if ( cp == NULL ) { + fclose(fp); return NULL; /* the process file is malformed */ + } ++cp; while (isspace(*cp)) ++cp;