Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion hw/xfree86/common/xf86Config.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,10 @@ xf86ValidateFontPath(char *path)
continue;
}
else {
XNFasprintf(&p1, "%s%s", dir_elem, DIR_FILE);
if (asprintf(&p1, "%s%s", dir_elem, DIR_FILE) == -1) {
xf86ErrorF("malloc failed\n");
continue;
}
flag = stat(p1, &stat_buf);
if (flag == 0)
if (!S_ISREG(stat_buf.st_mode))
Expand Down
36 changes: 23 additions & 13 deletions hw/xfree86/common/xf86Configure.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,17 @@ configureScreenSection(int screennum)
{
int i;
int depths[] = { 1, 4, 8, 15, 16, 24 /*, 32 */ };
char *tmp;
char *tmp = NULL;
parsePrologue(XF86ConfScreenPtr, XF86ConfScreenRec);

XNFasprintf(&tmp, "Screen%d", screennum);
if (asprintf(&tmp, "Screen%d", screennum) == -1)
return NULL;
ptr->scrn_identifier = tmp;
XNFasprintf(&tmp, "Monitor%d", screennum);
if (asprintf(&tmp, "Monitor%d", screennum) == -1)
return NULL;
ptr->scrn_monitor_str = tmp;
XNFasprintf(&tmp, "Card%d", screennum);
if (asprintf(&tmp, "Card%d", screennum) == -1)
return NULL;
ptr->scrn_device_str = tmp;

for (i = 0; i < ARRAY_SIZE(depths); i++) {
Expand Down Expand Up @@ -368,23 +371,24 @@ configureLayoutSection(void)
}

for (scrnum = 0; scrnum < nDevToConfig; scrnum++) {
char *tmp;
char *tmp = NULL;

XF86ConfAdjacencyPtr aptr = calloc(1, sizeof(XF86ConfAdjacencyRec));
assert(aptr);
aptr->list.next = NULL;
aptr->adj_x = 0;
aptr->adj_y = 0;
aptr->adj_scrnum = scrnum;
XNFasprintf(&tmp, "Screen%d", scrnum);
asprintf(&tmp, "Screen%d", scrnum);
aptr->adj_screen_str = tmp;
if (scrnum == 0) {
aptr->adj_where = CONF_ADJ_ABSOLUTE;
aptr->adj_refscreen = NULL;
}
else {
aptr->adj_where = CONF_ADJ_RIGHTOF;
XNFasprintf(&tmp, "Screen%d", scrnum - 1);
tmp = NULL;
asprintf(&tmp, "Screen%d", scrnum - 1);
aptr->adj_refscreen = tmp;
}
ptr->lay_adjacency_lst =
Expand Down Expand Up @@ -443,10 +447,11 @@ configureFilesSection(void)
static XF86ConfMonitorPtr
configureMonitorSection(int screennum)
{
char *tmp;
char *tmp = NULL;
parsePrologue(XF86ConfMonitorPtr, XF86ConfMonitorRec);

XNFasprintf(&tmp, "Monitor%d", screennum);
if (asprintf(&tmp, "Monitor%d", screennum) == -1)
return NULL;
ptr->mon_identifier = tmp;
ptr->mon_vendor = XNFstrdup("Monitor Vendor");
ptr->mon_modelname = XNFstrdup("Monitor Model");
Expand Down Expand Up @@ -492,10 +497,12 @@ configureDDCMonitorSection(int screennum)

parsePrologue(XF86ConfMonitorPtr, XF86ConfMonitorRec);

XNFasprintf(&tmp, "Monitor%d", screennum);
if (asprintf(&tmp, "Monitor%d", screennum) == -1)
return NULL;
ptr->mon_identifier = tmp;
ptr->mon_vendor = XNFstrdup(ConfiguredMonitor->vendor.name);
XNFasprintf(&ptr->mon_modelname, "%x", ConfiguredMonitor->vendor.prod_id);
if (asprintf(&ptr->mon_modelname, "%x", ConfiguredMonitor->vendor.prod_id) == -1)
FatalError("malloc failed\n");

/* features in centimetres, we want millimetres */
mon_width = 10 * ConfiguredMonitor->features.hsize;
Expand Down Expand Up @@ -866,8 +873,11 @@ DoShowOptions(void)
xf86DriverList[i]->driverName);
continue;
}
XNFasprintf(&pSymbol, "%sModuleData",
xf86DriverList[i]->driverName);
if (asprintf(&pSymbol, "%sModuleData",
xf86DriverList[i]->driverName) == -1) {
ErrorF("(EE) malloc failed\n");
continue;
}
initData = LoaderSymbol(pSymbol);
if (initData) {
XF86ModuleVersionInfo *vers = initData->vers;
Expand Down
7 changes: 4 additions & 3 deletions hw/xfree86/common/xf86pciBus.c
Original file line number Diff line number Diff line change
Expand Up @@ -1444,14 +1444,15 @@ xf86PciConfigureNewDev(void *busData, struct pci_device *pVideo,
GDevRec * GDev, int *chipset)
{
char busnum[8];
char *tmp;
char *tmp = NULL;

pVideo = (struct pci_device *) busData;

snprintf(busnum, sizeof(busnum), "%d", pVideo->bus);

XNFasprintf(&tmp, "PCI:%s:%d:%d",
busnum, pVideo->dev, pVideo->func);
if (asprintf(&tmp, "PCI:%s:%d:%d",
busnum, pVideo->dev, pVideo->func) == -1)
FatalError("malloc failed\n");
GDev->busID = tmp;

GDev->chipID = pVideo->device_id;
Expand Down
5 changes: 3 additions & 2 deletions hw/xfree86/common/xf86platformBus.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,9 @@ xf86platformProbe(void)

if (cl->modulepath && xf86ModPathFrom != X_CMDLINE) {
old_path = path;
XNFasprintf(&path, "%s,%s", cl->modulepath,
path ? path : xf86ModulePath);
if (asprintf(&path, "%s,%s", cl->modulepath,
path ? path : xf86ModulePath) == -1)
FatalError("malloc failed\n");
free(old_path);
LogMessageVerb(X_CONFIG, 1, "OutputClass \"%s\" ModulePath extended to \"%s\"\n",
cl->identifier, path);
Expand Down
6 changes: 3 additions & 3 deletions hw/xfree86/common/xf86sbusBus.c
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ void
xf86SbusConfigureNewDev(void *busData, sbusDevicePtr sBus, GDevRec * GDev)
{
char *promPath = NULL;
char *tmp;
char *tmp = NULL;

sBus = (sbusDevicePtr) busData;
GDev->identifier = sBus->descr;
Expand All @@ -726,11 +726,11 @@ xf86SbusConfigureNewDev(void *busData, sbusDevicePtr sBus, GDevRec * GDev)
sparcPromClose();
}
if (promPath) {
XNFasprintf(&tmp, "SBUS:%s", promPath);
asprintf(&tmp, "SBUS:%s", promPath);
free(promPath);
}
else {
XNFasprintf(&tmp, "SBUS:fb%d", sBus->fbNum);
asprintf(&tmp, "SBUS:fb%d", sBus->fbNum);
}
GDev->busID = tmp;
}
Loading