Re: [libvirt] [PATCH] usbFindBusByVendor: don't leak a DIR buffer and FD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]