aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/dri/dri.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xfree86/dri/dri.c')
-rw-r--r--xorg-server/hw/xfree86/dri/dri.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/xorg-server/hw/xfree86/dri/dri.c b/xorg-server/hw/xfree86/dri/dri.c
index c2f81b1c6..9ca5ecd0b 100644
--- a/xorg-server/hw/xfree86/dri/dri.c
+++ b/xorg-server/hw/xfree86/dri/dri.c
@@ -2426,13 +2426,10 @@ DRICreatePCIBusID(const struct pci_device * dev)
{
char *busID;
- busID = malloc(20);
- if (busID == NULL)
+ if (asprintf(&busID, "pci:%04x:%02x:%02x.%d",
+ dev->domain, dev->bus, dev->dev, dev->func) == -1)
return NULL;
- snprintf(busID, 20, "pci:%04x:%02x:%02x.%d", dev->domain, dev->bus,
- dev->dev, dev->func);
-
return busID;
}