mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
qemumigrationcookiexmltest: Don't crash when parsing of status XML fails
Some sub-tests dereference 'data->vm' even when it is NULL. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
85f5871186
commit
f0643a5759
@ -137,9 +137,17 @@ static int
|
|||||||
testQemuMigrationCookieParse(const void *opaque)
|
testQemuMigrationCookieParse(const void *opaque)
|
||||||
{
|
{
|
||||||
struct testQemuMigrationCookieData *data = (struct testQemuMigrationCookieData *) opaque;
|
struct testQemuMigrationCookieData *data = (struct testQemuMigrationCookieData *) opaque;
|
||||||
qemuDomainObjPrivate *priv = data->vm->privateData;
|
qemuDomainObjPrivate *priv;
|
||||||
g_auto(virBuffer) actual = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) actual = VIR_BUFFER_INITIALIZER;
|
||||||
|
|
||||||
|
/* if the VM object parsing step failed there's nothing this test can do */
|
||||||
|
if (!data->vm) {
|
||||||
|
VIR_TEST_DEBUG("\nmissing VM object\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
priv = data->vm->privateData;
|
||||||
|
|
||||||
if (!(data->cookie = qemuMigrationCookieParse(&driver,
|
if (!(data->cookie = qemuMigrationCookieParse(&driver,
|
||||||
data->vm,
|
data->vm,
|
||||||
data->vm->def,
|
data->vm->def,
|
||||||
@ -314,6 +322,12 @@ testQemuMigrationCookieBlockDirtyBitmaps(const void *opaque)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* if the VM object parsing step failed there's nothing this test can do */
|
||||||
|
if (!data->vm) {
|
||||||
|
VIR_TEST_DEBUG("\nmissing VM object\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (qemuMigrationCookieBlockDirtyBitmapsMatchDisks(data->vm->def,
|
if (qemuMigrationCookieBlockDirtyBitmapsMatchDisks(data->vm->def,
|
||||||
data->cookie->blockDirtyBitmaps) < 0)
|
data->cookie->blockDirtyBitmaps) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user