From: Emil Velikov Date: Sat, 21 Sep 2013 16:53:43 +0000 (+0100) Subject: st/xorg: add sanity checks after malloc X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2b7ffde8bd0d11258d0e71e01ec226022d51059a;p=mesa.git st/xorg: add sanity checks after malloc Signed-off-by: Emil Velikov Reviewed-by: Brian Paul --- diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index dd243bccbb9..097c3549ae8 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -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