st/xorg: add sanity checks after malloc

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
This commit is contained in:
Emil Velikov
2013-09-21 17:53:43 +01:00
parent 5c398e243c
commit 2b7ffde8bd
@@ -124,6 +124,9 @@ Bool
xorg_tracker_have_modesetting(ScrnInfoPtr pScrn, struct pci_device *device)
{
char *BusID = malloc(64);
if (!BusID)
return FALSE;
sprintf(BusID, "pci:%04x:%02x:%02x.%d",
device->domain, device->bus,
device->dev, device->func);
@@ -276,6 +279,9 @@ drv_init_drm(ScrnInfoPtr pScrn)
char *BusID;
BusID = malloc(64);
if (!BusID)
return FALSE;
sprintf(BusID, "PCI:%d:%d:%d",
((ms->PciInfo->domain << 8) | ms->PciInfo->bus),
ms->PciInfo->dev, ms->PciInfo->func