summaryrefslogtreecommitdiff
path: root/hw/xfree86/loader/loadmod.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2010-11-27 22:38:27 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2010-12-07 11:10:35 -0800
commit3a9bb93dd178084f4ff1abcea331ca5a62f88ce6 (patch)
treee82a82126bb89c4cb1956a531f8d10e0a88f030f /hw/xfree86/loader/loadmod.c
parent2416255f7e3fd9190a9e01bda57c992932de4bd9 (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/loader/loadmod.c')
-rw-r--r--hw/xfree86/loader/loadmod.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c
index 06d082b34..1f6933a3b 100644
--- a/hw/xfree86/loader/loadmod.c
+++ b/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;
}
}