[netperf-dev] netperf2 commit notice r488 - trunk/src

raj at netperf.org raj at netperf.org
Tue Sep 13 13:11:14 PDT 2011


Author: raj
Date: 2011-09-13 13:11:13 -0700 (Tue, 13 Sep 2011)
New Revision: 488

Modified:
   trunk/src/net_uuid.c
   trunk/src/netrt_rtnetlink.c
   trunk/src/netslot_linux.c
Log:
eliminate some file descriptor leaks in the egress interface and slot lookup code that are tripped over during confidence interval runs on systems with low file descriptor limits

Modified: trunk/src/net_uuid.c
===================================================================
--- trunk/src/net_uuid.c	2011-09-01 15:43:45 UTC (rev 487)
+++ trunk/src/net_uuid.c	2011-09-13 20:11:13 UTC (rev 488)
@@ -167,6 +167,7 @@
     seed[i++] = myrand >> 8;
   } while (i < 14);
 
+  fclose(fp);
 }
 
 #endif

Modified: trunk/src/netrt_rtnetlink.c
===================================================================
--- trunk/src/netrt_rtnetlink.c	2011-09-01 15:43:45 UTC (rev 487)
+++ trunk/src/netrt_rtnetlink.c	2011-09-13 20:11:13 UTC (rev 488)
@@ -92,12 +92,14 @@
       memcpy(RTA_DATA(rtap), &(in6->sin6_addr), sizeof(in6->sin6_addr));
     }
     else {
+      close(s);
       return strdup("UnknownAddressFamily");
     }
   }
   else {
     /* there must always be a destination */
     printf("No destination specified.\n");
+    close(s);
     return strdup("NoDestination");
   }
 
@@ -126,6 +128,7 @@
       memcpy(RTA_DATA(rtap), &(in6->sin6_addr), sizeof(in6->sin6_addr));
     }
     else {
+      close(s);
       return strdup("UnknownAddressFamily");
     }
      
@@ -154,6 +157,7 @@
   ret = sendmsg(s, &msg, 0);
 
   if (ret < 0) {
+    close(s);
     return strdup("SendmsgFailure");
   }
 
@@ -161,6 +165,7 @@
   ret = recv(s, reply, sizeof(reply), 0);
   
   if (ret < 0) {
+    close(s);
     return strdup("RecvmsgFailure");
   }
 
@@ -194,7 +199,7 @@
 	  interface_index = *((int *) RTA_DATA(rtap));
 	}
 	else {
-	  printf("Found a second interface index, which was not expected!\n");
+	  close(s);
 	  return strdup("MultipleInterfacesFound");
 	}
       }
@@ -207,9 +212,11 @@
   }
   else {
     if (NULL == if_indextoname(interface_index,interface_name)) {
+      close(s);
       return strdup("IfIndexToNameFailure");
     }
     else {
+      close(s);
       return strdup(interface_name);
     }
   }

Modified: trunk/src/netslot_linux.c
===================================================================
--- trunk/src/netslot_linux.c	2011-09-01 15:43:45 UTC (rev 487)
+++ trunk/src/netslot_linux.c	2011-09-13 20:11:13 UTC (rev 488)
@@ -59,6 +59,7 @@
 	fclose(address_file);
 	return 1;
     }
+    fclose(address_file);
   }
   return 0;
 }



More information about the netperf-dev mailing list