From owner-svn-src-all@FreeBSD.ORG Sun Apr 13 21:46:39 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A9F70B1; Sun, 13 Apr 2014 21:46:39 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 31B1618DE; Sun, 13 Apr 2014 21:46:39 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.8/8.14.8) with ESMTP id s3DLkXHJ088063; Mon, 14 Apr 2014 00:46:33 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua s3DLkXHJ088063 Received: (from kostik@localhost) by tom.home (8.14.8/8.14.8/Submit) id s3DLkX4v088062; Mon, 14 Apr 2014 00:46:33 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 14 Apr 2014 00:46:33 +0300 From: Konstantin Belousov To: Christian Brueffer Subject: Re: svn commit: r264422 - head/sys/kern Message-ID: <20140413214633.GF4016@kib.kiev.ua> References: <201404132123.s3DLNGvJ048359@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="0/kgSOzhNoDC5T3a" Content-Disposition: inline In-Reply-To: <201404132123.s3DLNGvJ048359@svn.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Apr 2014 21:46:39 -0000 --0/kgSOzhNoDC5T3a Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Apr 13, 2014 at 09:23:16PM +0000, Christian Brueffer wrote: > Author: brueffer > Date: Sun Apr 13 21:23:15 2014 > New Revision: 264422 > URL: http://svnweb.freebsd.org/changeset/base/264422 >=20 > Log: > Free buf after usage. > =20 > CID: 1199377 > Found with: Coverity Prevent(tm) > MFC after: 1 week >=20 > Modified: > head/sys/kern/imgact_elf.c >=20 > Modified: head/sys/kern/imgact_elf.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/kern/imgact_elf.c Sun Apr 13 21:13:33 2014 (r264421) > +++ head/sys/kern/imgact_elf.c Sun Apr 13 21:23:15 2014 (r264422) > @@ -1746,8 +1746,10 @@ __elfN(note_threadmd)(void *arg, struct=20 > size =3D 0; > __elfN(dump_thread)(td, buf, &size); > KASSERT(*sizep =3D=3D size, ("invalid size")); > - if (size !=3D 0 && sb !=3D NULL) > + if (size !=3D 0 && sb !=3D NULL) { > sbuf_bcat(sb, buf, size); > + free(buf, M_TEMP); > + } > *sizep =3D size; > } > =20 Why conditioning free() on size !=3D 0 ? IMO free(buf) must be done always, since buf is initialized for the case when malloc() is not called. --0/kgSOzhNoDC5T3a Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (FreeBSD) iQIcBAEBAgAGBQJTSwW5AAoJEJDCuSvBvK1BNy4P/RAs067+LZWgR0hysHK+PFWd AK8yX48NLHYt9iWbJH5QKVyN68VuFHjy4F+yWa0aiJwHH1mJ3OMjQnJurxsz7t+Z HNjcf5yk1E0+So1WZDOcYfCyIPGSa6Ns/B/YaQolYa53zabWuXvnqmK4iDhJjanV 3O/A7zix1dE3NHdedchN61Hf/ptrzw3wPmYpz9ozHvS+20uQh2SODR8wmKq5Y3iZ NZR/DY08Zc3pGYI3IdKTJaRs9fKGkQi7nUeoIj/g/cdPcblygbqkTauMRYiaxOVY 8dzj8cH3U73TVxcWez0PHW2yTofyiN2diKPuV+rw1JRrSknAdkdCDP9qFrrqm0v9 hK++4+dW5cjVnJRa2ZNig4xT1KKzNP4pN7R3F2tCGpDwqcnPGJizkf1fO5KSrxuw 38AHPgkfQbLpj/HXCCT6HDPfGF4w0z65sL8NliXoFYqzc+4qSgSp2AcDzX/gWuU+ RiKXjw6nji8Eqv3p3ZtM5qPE4i9jr9quz2St6xwmlg6cAsJc+UOerzYSueqSOwli NyxekdnHZz1a9+T2x3FdWFZU0AApVzEeHA+XR5fMt+stt5AnT78moG69hRodj7t1 4iabz/AYsaG2JpUle+M8SYlpgpIK/wKRsc9rNC70jnEwErwOfP9u4HFX/17i0jTs stf5+MaT6IO7F5Us4GJ3 =WbpZ -----END PGP SIGNATURE----- --0/kgSOzhNoDC5T3a--