diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2010-11-27 20:43:28 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2010-11-30 16:25:22 -0800 |
commit | 685286b17d30335d799a9da11914943e466ea955 (patch) | |
tree | df9d6ec1f0752b8a791f0c8c606f25268fdcb8ce | |
parent | 40d5a019352fa8f12230c863e11cbb1f6258a93e (diff) |
FindModuleInSubdir: Stop allocating one more byte than needed
15ac25627e7239629be59 removed the "/" from the sprintf strings,
but failed to remove the extra byte allocated for the '/'.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Julien Cristau <jcristau@debian.org>
-rw-r--r-- | hw/xfree86/loader/loadmod.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c index 6e6522774..06d082b34 100644 --- a/hw/xfree86/loader/loadmod.c +++ b/hw/xfree86/loader/loadmod.c @@ -406,21 +406,21 @@ 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) + 2); + ret = malloc(strlen(tmpBuf) + strlen(dirpath) + 1); sprintf(ret, "%s%s", dirpath, tmpBuf); break; } snprintf(tmpBuf, PATH_MAX, "%s_drv.so", module); if (strcmp(direntry->d_name, tmpBuf) == 0) { - ret = malloc(strlen(tmpBuf) + strlen(dirpath) + 2); + ret = malloc(strlen(tmpBuf) + strlen(dirpath) + 1); sprintf(ret, "%s%s", dirpath, tmpBuf); break; } snprintf(tmpBuf, PATH_MAX, "%s.so", module); if (strcmp(direntry->d_name, tmpBuf) == 0) { - ret = malloc(strlen(tmpBuf) + strlen(dirpath) + 2); + ret = malloc(strlen(tmpBuf) + strlen(dirpath) + 1); sprintf(ret, "%s%s", dirpath, tmpBuf); break; } |