[PATCH] openvz: fixed two memory leaks on migration code

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

 



---
 src/openvz/openvz_driver.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index 57b3c22..3147311 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -2364,7 +2364,10 @@ openvzDomainMigratePrepare3Params(virConnectPtr dconn,
     }
 
  done:
-    virURIFree(uri);
+    if (!uri_in)
+        VIR_FREE(hostname);
+    else
+        virURIFree(uri);
     if (vm)
         virObjectUnlock(vm);
     return ret;
@@ -2385,7 +2388,7 @@ openvzDomainMigratePerform3Params(virDomainPtr domain,
     virDomainObjPtr vm = NULL;
     const char *uri_str = NULL;
     virURIPtr uri = NULL;
-    virCommandPtr cmd = virCommandNew(VZMIGRATE);
+    virCommandPtr cmd = NULL;
     int ret = -1;
 
     virCheckFlags(OPENVZ_MIGRATION_FLAGS, -1);
@@ -2412,6 +2415,7 @@ openvzDomainMigratePerform3Params(virDomainPtr domain,
     if (uri == NULL || uri->server == NULL)
         goto cleanup;
 
+    cmd = virCommandNew(VZMIGRATE);
     if (flags & VIR_MIGRATE_LIVE)
         virCommandAddArg(cmd, "--live");
     virCommandAddArg(cmd, uri->server);
-- 
1.7.1

--
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]