mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-01-18 12:10:27 +01:00
FindModuleInSubdir: Stop allocating one more byte than needed
15ac25627e 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>
This commit is contained in:
parent
40d5a01935
commit
685286b17d
1 changed files with 3 additions and 3 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue