mirror of
https://github.com/X11Libre/xserver.git
synced 2026-10-07 23:02:23 +00:00
Convert alloc+sprintf pairs into asprintf() & XNFasprintf() calls
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
This commit is contained in:
parent
2416255f7e
commit
3a9bb93dd1
11 changed files with 36 additions and 62 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue