1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-01-12 15:52:55 +00:00

remote: Fix memory leak in remoteDomainMigrateFinish3*

Theoretically, when remoteDomainMigrateFinish3* is called without a
pointer for storing migration cookie or 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@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
Jiri Denemark 2023-01-26 16:54:06 +01:00
parent 6f3f6c0f76
commit 648391f170

@ -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);