diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2010-11-27 22:38:27 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2010-12-07 11:10:35 -0800 |
commit | 3a9bb93dd178084f4ff1abcea331ca5a62f88ce6 (patch) | |
tree | e82a82126bb89c4cb1956a531f8d10e0a88f030f /hw/xfree86/dri/dri.c | |
parent | 2416255f7e3fd9190a9e01bda57c992932de4bd9 (diff) |
Convert alloc+sprintf pairs into asprintf() & XNFasprintf() calls
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Diffstat (limited to 'hw/xfree86/dri/dri.c')
-rw-r--r-- | hw/xfree86/dri/dri.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c index fe99a2dcc..1d83630a5 100644 --- a/hw/xfree86/dri/dri.c +++ b/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; } |