[libvirt] [PATCH] usbFindBusByVendor: don't leak a DIR buffer and FD
Eric Blake
ebb9 at byu.net
Tue Jan 26 13:29:25 UTC 2010
According to Jim Meyering on 1/25/2010 8:55 AM:
> Subject: [PATCH] hostusb: closedir only if non-NULL; rename labels: s/error/cleanup/
>
> * src/util/hostusb.c (usbSysReadFile): Rename labels s/error/cleanup/
> (usbFindBusByVendor): Likewise. And closedir only if non-NULL.
> @@ -150,8 +150,9 @@ static int usbFindBusByVendor(virConnectPtr conn,
> else
> ret = 0;
>
> -error:
> - closedir (dir);
> +cleanup:
> + if (dir)
> + closedir (dir);
Should errno be saved and restored around this point, to avoid it being
arbitrarily changed by closedir?
--
Don't work too hard, make some time for fun as well!
Eric Blake ebb9 at byu.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 320 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20100126/22ed5654/attachment-0001.sig>
More information about the libvir-list
mailing list