mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
hyperv: prevent potential NULL dereference
Return value of a function 'virDomainChrDefNew' is dereferenced at hyperv_driver.c without checking for NULL, which can lead to NULL dereference immediately after. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Oleg Sviridov <oleg.sviridov@red-soft.ru> Reviewed-by: Kristína Hanicová <khanicov@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
3146305fd3
commit
a42f11c40b
@ -1534,7 +1534,8 @@ hypervDomainDefParseSerial(virDomainDef *def, Msvm_ResourceAllocationSettingData
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
serial = virDomainChrDefNew(NULL);
|
if (!(serial = virDomainChrDefNew(NULL)))
|
||||||
|
return -1;
|
||||||
|
|
||||||
serial->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL;
|
serial->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL;
|
||||||
serial->source->type = VIR_DOMAIN_CHR_TYPE_PIPE;
|
serial->source->type = VIR_DOMAIN_CHR_TYPE_PIPE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user