From 3a20d23b48c1051e1f22295fd886cc7f643417f6 Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 10 Dec 2010 19:06:59 +0000 Subject: xserver git update 10/12/2010 --- xorg-server/hw/xfree86/loader/loadmod.c | 18 ++++++++---------- xorg-server/hw/xfree86/loader/sdksyms.sh | 1 + 2 files changed, 9 insertions(+), 10 deletions(-) (limited to 'xorg-server/hw/xfree86/loader') diff --git a/xorg-server/hw/xfree86/loader/loadmod.c b/xorg-server/hw/xfree86/loader/loadmod.c index 6fcb06df2..dbc16eab7 100644 --- a/xorg-server/hw/xfree86/loader/loadmod.c +++ b/xorg-server/hw/xfree86/loader/loadmod.c @@ -406,22 +406,22 @@ FindModuleInSubdir(const char *dirpath, const char *module) snprintf(tmpBuf, PATH_MAX, "lib%s.so", module); if (strcmp(direntry->d_name, tmpBuf) == 0) { - ret = malloc(strlen(tmpBuf) + strlen(dirpath) + 1); - sprintf(ret, "%s%s", dirpath, tmpBuf); + if (asprintf(&ret, "%s%s", dirpath, tmpBuf) == -1) + ret = NULL; break; } snprintf(tmpBuf, PATH_MAX, "%s_drv.so", module); if (strcmp(direntry->d_name, tmpBuf) == 0) { - ret = malloc(strlen(tmpBuf) + strlen(dirpath) + 1); - sprintf(ret, "%s%s", dirpath, tmpBuf); + if (asprintf(&ret, "%s%s", dirpath, tmpBuf) == -1) + ret = NULL; break; } snprintf(tmpBuf, PATH_MAX, "%s.so", module); if (strcmp(direntry->d_name, tmpBuf) == 0) { - ret = malloc(strlen(tmpBuf) + strlen(dirpath) + 1); - sprintf(ret, "%s%s", dirpath, tmpBuf); + if (asprintf(&ret, "%s%s", dirpath, tmpBuf) == -1) + ret = NULL; break; } } @@ -933,16 +933,14 @@ doLoadModule(const char *module, const char *path, const char **subdirlist, * now check if the special data object ModuleData is * present. */ - p = malloc(strlen(name) + strlen("ModuleData") + 1); - if (!p) { + if (asprintf(&p, "%sModuleData", name) == -1) { + p = NULL; if (errmaj) *errmaj = LDR_NOMEM; if (errmin) *errmin = 0; goto LoadModule_fail; } - strcpy(p, name); - strcat(p, "ModuleData"); initdata = LoaderSymbol(p); if (initdata) { ModuleSetupProc setup; diff --git a/xorg-server/hw/xfree86/loader/sdksyms.sh b/xorg-server/hw/xfree86/loader/sdksyms.sh index d69ae769e..c25aaf010 100644 --- a/xorg-server/hw/xfree86/loader/sdksyms.sh +++ b/xorg-server/hw/xfree86/loader/sdksyms.sh @@ -253,6 +253,7 @@ cat > sdksyms.c << EOF /* include/Makefile.am */ #include "XIstubs.h" +#include "Xprintf.h" #include "closestr.h" #include "closure.h" #include "colormap.h" -- cgit v1.2.3