aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/loader/loadmod.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-12-10 19:06:59 +0000
committermarha <marha@users.sourceforge.net>2010-12-10 19:06:59 +0000
commit3a20d23b48c1051e1f22295fd886cc7f643417f6 (patch)
tree5192dddd9ecf591de2e22504f7268c2935382d90 /xorg-server/hw/xfree86/loader/loadmod.c
parent531a0d974b98074978535f086a73b6b662fa0cea (diff)
downloadvcxsrv-3a20d23b48c1051e1f22295fd886cc7f643417f6.tar.gz
vcxsrv-3a20d23b48c1051e1f22295fd886cc7f643417f6.tar.bz2
vcxsrv-3a20d23b48c1051e1f22295fd886cc7f643417f6.zip
xserver git update 10/12/2010
Diffstat (limited to 'xorg-server/hw/xfree86/loader/loadmod.c')
-rw-r--r--xorg-server/hw/xfree86/loader/loadmod.c18
1 files changed, 8 insertions, 10 deletions
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 <modulename>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;