mirror of
https://github.com/X11Libre/xf86-video-ati.git
synced 2026-03-24 01:24:43 +00:00
don't crash Xserver on malloc() failure anymore (XNFasprintf)
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
committed by
Enrico Weigelt
parent
45f03ac5d8
commit
e237014dc6
@@ -203,11 +203,14 @@ ati_gdev_subdriver(pointer options)
|
||||
}
|
||||
|
||||
if (chip_family == ATI_CHIP_FAMILY_Radeon) {
|
||||
char *busid;
|
||||
char *busid = NULL;
|
||||
|
||||
XNFasprintf(&busid, "pci:%04x:%02x:%02x.%d",
|
||||
if (asprintf(&busid, "pci:%04x:%02x:%02x.%d",
|
||||
device->domain, device->bus, device->dev,
|
||||
device->func);
|
||||
device->func) == -1) {
|
||||
ErrorF("ati: malloc() failed\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (busid) {
|
||||
int fd = drmOpen(NULL, busid);
|
||||
|
||||
@@ -2843,7 +2843,11 @@ Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp)
|
||||
drmmode_clones_init(pScrn, drmmode, mode_res);
|
||||
|
||||
bus_id_string = DRICreatePCIBusID(info->PciInfo);
|
||||
XNFasprintf(&provider_name, "%s @ %s", pScrn->chipset, bus_id_string);
|
||||
if (asprintf(&provider_name, "%s @ %s", pScrn->chipset, bus_id_string) == -1) {
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "malloc() failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
free(bus_id_string);
|
||||
xf86ProviderSetup(pScrn, NULL, provider_name);
|
||||
free(provider_name);
|
||||
|
||||
@@ -1530,8 +1530,11 @@ static int radeon_get_drm_master_fd(ScrnInfoPtr pScrn)
|
||||
}
|
||||
#endif
|
||||
|
||||
XNFasprintf(&busid, "pci:%04x:%02x:%02x.%d",
|
||||
dev->domain, dev->bus, dev->dev, dev->func);
|
||||
if (asprintf(&busid, "pci:%04x:%02x:%02x.%d",
|
||||
dev->domain, dev->bus, dev->dev, dev->func) == -1) {
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "malloc() failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef __DragonFly__
|
||||
/* On DragonFlyBSD Appropriate kernel drivers need to be loaded before
|
||||
|
||||
Reference in New Issue
Block a user