diff options
author | Akira TAGOH <akira@tagoh.org> | 2015-03-03 11:30:12 +0900 |
---|---|---|
committer | Akira TAGOH <akira@tagoh.org> | 2015-03-03 11:30:12 +0900 |
commit | 2f311c562d87c0bf95d27709e82afd196c2bff28 (patch) | |
tree | 7d09e866214002501da55936bc6d1acc4f8734f6 | |
parent | f18f2f88f287a2438d2bf9b27773cb14606cbb11 (diff) |
Fix the array allocation
-rw-r--r-- | src/fcstat.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/fcstat.c b/src/fcstat.c index d444bf9c..1734fa42 100644 --- a/src/fcstat.c +++ b/src/fcstat.c @@ -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); |