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

Re: [Xen-devel] [PATCH v3 2/7] libxl: style cleanups in libxl_device_pci_assignable_list()



On Wed, 2016-04-20 at 22:24 +0200, Olaf Hering wrote:
> On Wed, Apr 20, Paulina Szubarczyk wrote:
> 
> > @@ -398,34 +398,34 @@ libxl_device_pci 
> > *libxl_device_pci_assignable_list(libxl_ctx *ctx, int *num)
> >      dir = opendir(SYSFS_PCIBACK_DRIVER);
> 
> > +    while((de = readdir(dir))) {
> 
> > -    closedir(dir);
> 
> This change seems to leak 'dir' in success case.

I am sorry, that is true. 

The previous out_closedir path was run from the path after the
condition:
+    if (NULL == dir) {

-        goto out_closedir;
+        closedir(dir);
+        goto out;
     }

-out_closedir:
-    closedir(dir);
 out:
     GC_FREE;
     return pcidevs;

so in this case it could just jump to goto out without calling
closedir(NULL). 

Paulina

> Olaf



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.