Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Apr 2006 20:08:42 -0400
From:      Joe Marcus Clarke <marcus@FreeBSD.org>
To:        Scott Long <scottl@samsco.org>
Cc:        freebsd-current@FreeBSD.org
Subject:   Re: File descriptor leak in libcam
Message-ID:  <1146355722.16564.20.camel@shumai.marcuscom.com>
In-Reply-To: <4453FB29.3040309@samsco.org>
References:  <1146346120.16564.12.camel@shumai.marcuscom.com> <4453FB29.3040309@samsco.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--=-8KAcoAn+HEAAR7LRJKV1
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Sat, 2006-04-29 at 17:47 -0600, Scott Long wrote:
> Joe Marcus Clarke wrote:
> > There is a leak in the cam_lookup_pass() if the ioctl call fails to fin=
d
> > the passthru device.  Basically, the xpt file descriptor will not be
> > closed.  Can anyone give me permission to commit the following patch?
> > Thanks.
> >=20
> > http://www.marcuscom.com/downloads/camlib.c.diff
> >=20
> > Joe
> >=20
>=20
> Looks good to me.  Style-wise, I'd have it close the fd before
> testing the return of the ioctl, but that's minor.

So you'd rather see something like:

int rc;
...

rc =3D ioctl(fd, CAMGETPASSTHRU, &ccb);
close(fd);

if (rc =3D=3D -1) {
...

Joe

--=20
Joe Marcus Clarke
FreeBSD GNOME Team      ::      gnome@FreeBSD.org
FreeNode / #freebsd-gnome
http://www.FreeBSD.org/gnome

--=-8KAcoAn+HEAAR7LRJKV1
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (FreeBSD)

iD8DBQBEVAAKb2iPiv4Uz4cRAsOEAJ0RDYhxx/F9Av7Guch+fhukeH0sMQCfQzXX
/ukbIuAA4bBiktaZE+66urQ=
=iTGW
-----END PGP SIGNATURE-----

--=-8KAcoAn+HEAAR7LRJKV1--




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1146355722.16564.20.camel>