Re: [libvirt] [PATCH 3/3] libxl: remove unneeded cleanup_unlock label

2015-03-05 Thread Michal Privoznik
On 04.03.2015 01:09, Jim Fehlig wrote:
> In the old days of a global driver lock, it was necessary to unlock
> the driver after a domain restore operation.  When the global lock
> was removed from the driver, some remnants were left behind in
> libxlDomainRestoreFlags.  Remove this unneeded (and incorrect) code.
> 
> Signed-off-by: Jim Fehlig 
> ---
>  src/libxl/libxl_driver.c | 10 +++---
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
> index ce3a99b..55fa64f 100644
> --- a/src/libxl/libxl_driver.c
> +++ b/src/libxl/libxl_driver.c
> @@ -1464,17 +1464,17 @@ libxlDomainRestoreFlags(virConnectPtr conn, const 
> char *from,
>  
>  fd = libxlDomainSaveImageOpen(driver, cfg, from, &def, &hdr);
>  if (fd < 0)
> -goto cleanup_unlock;
> +return -1;

While this one is okay, ...

>  
>  if (virDomainRestoreFlagsEnsureACL(conn, def) < 0)
> -goto cleanup_unlock;
> +return -1;

.. this one's not. If EnsureACL fails, the @fd opened just above is
leaked. ACKed with s/return -1/goto cleanup/.

Michal

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


[libvirt] [PATCH 3/3] libxl: remove unneeded cleanup_unlock label

2015-03-03 Thread Jim Fehlig
In the old days of a global driver lock, it was necessary to unlock
the driver after a domain restore operation.  When the global lock
was removed from the driver, some remnants were left behind in
libxlDomainRestoreFlags.  Remove this unneeded (and incorrect) code.

Signed-off-by: Jim Fehlig 
---
 src/libxl/libxl_driver.c | 10 +++---
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index ce3a99b..55fa64f 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -1464,17 +1464,17 @@ libxlDomainRestoreFlags(virConnectPtr conn, const char 
*from,
 
 fd = libxlDomainSaveImageOpen(driver, cfg, from, &def, &hdr);
 if (fd < 0)
-goto cleanup_unlock;
+return -1;
 
 if (virDomainRestoreFlagsEnsureACL(conn, def) < 0)
-goto cleanup_unlock;
+return -1;
 
 if (!(vm = virDomainObjListAdd(driver->domains, def,
driver->xmlopt,
VIR_DOMAIN_OBJ_LIST_ADD_LIVE |
VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
NULL)))
-goto cleanup_unlock;
+goto cleanup;
 
 def = NULL;
 
@@ -1492,10 +1492,6 @@ libxlDomainRestoreFlags(virConnectPtr conn, const char 
*from,
 virObjectUnlock(vm);
 virObjectUnref(cfg);
 return ret;
-
- cleanup_unlock:
-libxlDriverUnlock(driver);
-goto cleanup;
 }
 
 static int
-- 
1.8.4.5

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