mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-13 00:01: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:
parent
6f3f6c0f76
commit
648391f170
@ -5917,8 +5917,6 @@ remoteDomainMigrateFinish3(virConnectPtr dconn,
|
|||||||
(xdrproc_t) xdr_remote_domain_migrate_finish3_ret, (char *) &ret) == -1)
|
(xdrproc_t) xdr_remote_domain_migrate_finish3_ret, (char *) &ret) == -1)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
rv = get_nonnull_domain(dconn, ret.dom);
|
|
||||||
|
|
||||||
if (ret.cookie_out.cookie_out_len > 0) {
|
if (ret.cookie_out.cookie_out_len > 0) {
|
||||||
if (!cookieout || !cookieoutlen) {
|
if (!cookieout || !cookieoutlen) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
@ -5930,6 +5928,8 @@ remoteDomainMigrateFinish3(virConnectPtr dconn,
|
|||||||
ret.cookie_out.cookie_out_len = 0;
|
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);
|
xdr_free((xdrproc_t) &xdr_remote_domain_migrate_finish3_ret, (char *) &ret);
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
@ -6770,8 +6770,6 @@ remoteDomainMigrateFinish3Params(virConnectPtr dconn,
|
|||||||
(char *) &ret) == -1)
|
(char *) &ret) == -1)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
rv = get_nonnull_domain(dconn, ret.dom);
|
|
||||||
|
|
||||||
if (ret.cookie_out.cookie_out_len > 0) {
|
if (ret.cookie_out.cookie_out_len > 0) {
|
||||||
if (!cookieout || !cookieoutlen) {
|
if (!cookieout || !cookieoutlen) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
@ -6783,6 +6781,8 @@ remoteDomainMigrateFinish3Params(virConnectPtr dconn,
|
|||||||
ret.cookie_out.cookie_out_len = 0;
|
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,
|
xdr_free((xdrproc_t) &xdr_remote_domain_migrate_finish3_params_ret,
|
||||||
(char *) &ret);
|
(char *) &ret);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user