Theoretically, when remoteDomainMigrateFinish3* is called without a
pointer for storing migration cookie and its length (i.e., either
cookieout == NULL or cookieoutlen == NULL), we would leak the freshly
created virDomain object referenced by rv.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/remote/remote_driver.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 2f421fb5e0..9fc73f6d88 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -5917,8 +5917,6 @@ remoteDomainMigrateFinish3(virConnectPtr dconn,
(xdrproc_t) xdr_remote_domain_migrate_finish3_ret, (char *) &ret) ==
-1)
return NULL;
- rv = get_nonnull_domain(dconn, ret.dom);
-
if (ret.cookie_out.cookie_out_len > 0) {
if (!cookieout || !cookieoutlen) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -5930,6 +5928,8 @@ remoteDomainMigrateFinish3(virConnectPtr dconn,
ret.cookie_out.cookie_out_len = 0;
}
+ rv = get_nonnull_domain(dconn, ret.dom);
+
xdr_free((xdrproc_t) &xdr_remote_domain_migrate_finish3_ret, (char *) &ret);
return rv;
@@ -6770,8 +6770,6 @@ remoteDomainMigrateFinish3Params(virConnectPtr dconn,
(char *) &ret) == -1)
goto cleanup;
- rv = get_nonnull_domain(dconn, ret.dom);
-
if (ret.cookie_out.cookie_out_len > 0) {
if (!cookieout || !cookieoutlen) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -6783,6 +6781,8 @@ remoteDomainMigrateFinish3Params(virConnectPtr dconn,
ret.cookie_out.cookie_out_len = 0;
}
+ rv = get_nonnull_domain(dconn, ret.dom);
+
xdr_free((xdrproc_t) &xdr_remote_domain_migrate_finish3_params_ret,
(char *) &ret);
--
2.39.1