From owner-svn-src-head@FreeBSD.ORG Sun Oct 16 16:02:08 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 19CE71065673; Sun, 16 Oct 2011 16:02:08 +0000 (UTC) (envelope-from pawel@dawidek.net) Received: from mail.dawidek.net (60.wheelsystems.com [83.12.187.60]) by mx1.freebsd.org (Postfix) with ESMTP id BDF8A8FC08; Sun, 16 Oct 2011 16:02:07 +0000 (UTC) Received: from localhost (89-73-195-149.dynamic.chello.pl [89.73.195.149]) by mail.dawidek.net (Postfix) with ESMTPSA id 50089850; Sun, 16 Oct 2011 17:46:56 +0200 (CEST) Date: Sun, 16 Oct 2011 17:46:12 +0200 From: Pawel Jakub Dawidek To: Christian Brueffer Message-ID: <20111016154611.GA1832@garage.freebsd.pl> References: <201110151557.p9FFvuuc020536@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="/04w6evG8XlLl3ft" Content-Disposition: inline In-Reply-To: <201110151557.p9FFvuuc020536@svn.freebsd.org> X-OS: FreeBSD 9.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r226398 - head/sys/dev/iicbus X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2011 16:02:08 -0000 --/04w6evG8XlLl3ft Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Oct 15, 2011 at 03:57:56PM +0000, Christian Brueffer wrote: > Author: brueffer > Date: Sat Oct 15 15:57:55 2011 > New Revision: 226398 > URL: http://svn.freebsd.org/changeset/base/226398 >=20 > Log: > Properly free resources in an error case. > =20 > CID: 4203 > Found with: Coverity Prevent(tm) > MFC after: 1 week >=20 > Modified: > head/sys/dev/iicbus/iic.c >=20 > Modified: head/sys/dev/iicbus/iic.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/iicbus/iic.c Sat Oct 15 15:21:33 2011 (r226397) > +++ head/sys/dev/iicbus/iic.c Sat Oct 15 15:57:55 2011 (r226398) > @@ -348,8 +348,10 @@ iicioctl(struct cdev *dev, u_long cmd, c > buf =3D malloc(sizeof(*d->msgs) * d->nmsgs, M_TEMP, M_WAITOK); > usrbufs =3D malloc(sizeof(void *) * d->nmsgs, M_TEMP, M_ZERO | M_WAITO= K); > error =3D copyin(d->msgs, buf, sizeof(*d->msgs) * d->nmsgs); > - if (error) > + if (error) { > + free(usrbufs, M_TEMP); > break; > + } I think that better fix is to move usrbufs allocation after copyin(), as usrbufs is not used there. --=20 Pawel Jakub Dawidek http://www.wheelsystems.com FreeBSD committer http://www.FreeBSD.org Am I Evil? Yes, I Am! http://yomoli.com --/04w6evG8XlLl3ft Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk6a/EMACgkQForvXbEpPzRoewCgiEM/YOUQpHgZyfj3G/SJ7nnc nW0AoL/Ec8dM5QzJW6NMFxgwfyM/QgCW =X6L5 -----END PGP SIGNATURE----- --/04w6evG8XlLl3ft--