mirror of https://gitee.com/openkylin/libvirt.git
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;
|
||||
}
|
||||
|
||||
serial = virDomainChrDefNew(NULL);
|
||||
if (!(serial = virDomainChrDefNew(NULL)))
|
||||
return -1;
|
||||
|
||||
serial->deviceType = VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL;
|
||||
serial->source->type = VIR_DOMAIN_CHR_TYPE_PIPE;
|
||||
|
|
Loading…
Reference in New Issue