mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 15:15:25 +00:00
Fix potential NULL dereference in remoteDomainMigratePrepare2
This commit is contained in:
parent
49ed0a2e1b
commit
272d5a9653
@ -2849,17 +2849,34 @@ remoteDomainMigratePrepare2 (virConnectPtr dconn,
|
||||
goto done;
|
||||
|
||||
if (ret.cookie.cookie_len > 0) {
|
||||
if (!cookie || !cookielen) {
|
||||
remoteError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("caller ignores cookie or cookielen"));
|
||||
goto error;
|
||||
}
|
||||
*cookie = ret.cookie.cookie_val; /* Caller frees. */
|
||||
*cookielen = ret.cookie.cookie_len;
|
||||
}
|
||||
if (ret.uri_out)
|
||||
if (ret.uri_out) {
|
||||
if (!uri_out) {
|
||||
remoteError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("caller ignores uri_out"));
|
||||
goto error;
|
||||
}
|
||||
*uri_out = *ret.uri_out; /* Caller frees. */
|
||||
}
|
||||
|
||||
rv = 0;
|
||||
|
||||
done:
|
||||
remoteDriverUnlock(priv);
|
||||
return rv;
|
||||
error:
|
||||
if (ret.cookie.cookie_len)
|
||||
VIR_FREE(ret.cookie.cookie_val);
|
||||
if (ret.uri_out)
|
||||
VIR_FREE(*ret.uri_out);
|
||||
goto done;
|
||||
}
|
||||
|
||||
static virDomainPtr
|
||||
|
Loading…
Reference in New Issue
Block a user