svn commit: r215353 - head/sys/dev/mii

Jung-uk Kim jkim at FreeBSD.org
Mon Nov 15 23:13:25 UTC 2010


Author: jkim
Date: Mon Nov 15 23:13:25 2010
New Revision: 215353
URL: http://svn.freebsd.org/changeset/base/215353

Log:
  Plug memory leakage introduced in r204989.
  
  Reported by:	yongari

Modified:
  head/sys/dev/mii/brgphy.c

Modified: head/sys/dev/mii/brgphy.c
==============================================================================
--- head/sys/dev/mii/brgphy.c	Mon Nov 15 22:12:13 2010	(r215352)
+++ head/sys/dev/mii/brgphy.c	Mon Nov 15 23:13:25 2010	(r215353)
@@ -154,15 +154,18 @@ static int
 detect_hs21(struct bce_softc *bce_sc)
 {
 	char *sysenv;
+	int found;
 
-	if (bce_sc->bce_chipid != HS21_BCM_CHIPID)
-		return (0);
-	sysenv = getenv("smbios.system.product");
-	if (sysenv == NULL)
-		return (0);
-	if (strncmp(sysenv, HS21_PRODUCT_ID, strlen(HS21_PRODUCT_ID)) != 0)
-		return (0);
-	return (1);
+	found = 0;
+	if (bce_sc->bce_chipid == HS21_BCM_CHIPID) {
+		sysenv = getenv("smbios.system.product");
+		if (sysenv != NULL) {
+			if (strcmp(sysenv, HS21_PRODUCT_ID) == 0)
+				found = 1;
+			freeenv(sysenv);
+		}
+	}
+	return (found);
 }
 
 /* Search for our PHY in the list of known PHYs */


More information about the svn-src-all mailing list