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

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



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


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