mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 07:59:00 +00:00
domain_conf: fix NULL dereference on error in virDomainObjCopyPersistentDef
The issue was introduced together with the function itself by commit <da1eba6bc8f58bfce34136710d1979a3a44adb17>. Calling `virDomainObjGetPersistentDef` may return NULL which is later passed to `virDomainDefFormat` where the `def` attribute is marked as NONNULL and later in `virDomainDefFormatInternalSetRootName` it is actually defererenced without any other check. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
ba6385c952
commit
b96174d9f2
@ -30933,6 +30933,12 @@ virDomainObjCopyPersistentDef(virDomainObjPtr dom,
|
|||||||
virDomainDefPtr cur;
|
virDomainDefPtr cur;
|
||||||
|
|
||||||
cur = virDomainObjGetPersistentDef(xmlopt, dom, parseOpaque);
|
cur = virDomainObjGetPersistentDef(xmlopt, dom, parseOpaque);
|
||||||
|
if (!cur) {
|
||||||
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
|
_("failed to get persistent definition object"));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
return virDomainDefCopy(cur, xmlopt, parseOpaque, false);
|
return virDomainDefCopy(cur, xmlopt, parseOpaque, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user