Date: Mon, 15 Nov 2010 23:13:25 +0000 (UTC) From: Jung-uk Kim <jkim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r215353 - head/sys/dev/mii Message-ID: <201011152313.oAFNDP7e031703@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011152313.oAFNDP7e031703>