Fix the array allocation

This commit is contained in:
Akira TAGOH 2015-03-03 11:30:12 +09:00
parent f18f2f88f2
commit 2f311c562d
1 changed files with 1 additions and 1 deletions

View File

@ -219,7 +219,7 @@ FcScandir (const char *dirp,
dentlen = ((dentlen + ALIGNOF_VOID_P - 1) & ~(ALIGNOF_VOID_P - 1));
p = (struct dirent *) malloc (dentlen);
memcpy (p, dent, dentlen);
if (n >= lsize)
if ((n + 1) >= lsize)
{
lsize += 128;
dlp = (struct dirent **) realloc (dlist, sizeof (struct dirent *) * lsize);