提交 1222a303 编写于 作者: J John Ferlan

libxl: Free migration cookie

Commit id 'f9edcfa4' added cookie manipulation for libxl; however, some
cookie crumb cleanup was missed. Found by Coverity.

In libxlDomainMigrationBegin, the cookie is allocated and baked; however,
the mig ingredients weren't cleaned up.

In libxlDomainMigrationPrepare, when the 'mig' cookie is added to the
args, set the 'mig = NULL'; otherwise, other failure paths between when
the code ate the cookie data and when it was added to args would fail
to clean up the crumbs.
Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
上级 52760707
...@@ -402,7 +402,7 @@ libxlDomainMigrationBegin(virConnectPtr conn, ...@@ -402,7 +402,7 @@ libxlDomainMigrationBegin(virConnectPtr conn,
{ {
libxlDriverPrivatePtr driver = conn->privateData; libxlDriverPrivatePtr driver = conn->privateData;
libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver); libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
libxlMigrationCookiePtr mig; libxlMigrationCookiePtr mig = NULL;
virDomainDefPtr tmpdef = NULL; virDomainDefPtr tmpdef = NULL;
virDomainDefPtr def; virDomainDefPtr def;
char *xml = NULL; char *xml = NULL;
...@@ -440,6 +440,7 @@ libxlDomainMigrationBegin(virConnectPtr conn, ...@@ -440,6 +440,7 @@ libxlDomainMigrationBegin(virConnectPtr conn,
vm = NULL; vm = NULL;
cleanup: cleanup:
libxlMigrationCookieFree(mig);
if (vm) if (vm)
virObjectUnlock(vm); virObjectUnlock(vm);
...@@ -601,6 +602,7 @@ libxlDomainMigrationPrepare(virConnectPtr dconn, ...@@ -601,6 +602,7 @@ libxlDomainMigrationPrepare(virConnectPtr dconn,
args->socks = socks; args->socks = socks;
args->nsocks = nsocks; args->nsocks = nsocks;
args->migcookie = mig; args->migcookie = mig;
mig = NULL;
for (i = 0; i < nsocks; i++) { for (i = 0; i < nsocks; i++) {
if (virNetSocketSetBlocking(socks[i], true) < 0) if (virNetSocketSetBlocking(socks[i], true) < 0)
...@@ -640,6 +642,7 @@ libxlDomainMigrationPrepare(virConnectPtr dconn, ...@@ -640,6 +642,7 @@ libxlDomainMigrationPrepare(virConnectPtr dconn,
} }
done: done:
libxlMigrationCookieFree(mig);
if (!uri_in) if (!uri_in)
VIR_FREE(hostname); VIR_FREE(hostname);
else else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册