Your malloc is incorrect. fileCount * sizeof(char[9]) is equal to fileCount * 9, which is not a size you want to use for a double char pointer. Your double char pointer should point to a segment of data which is a multiple of sizeof(char*), not a multiple of 9.
Try something like:
allFilenames = malloc(fileCount * sizeof(char*));
for(int i = 0; i < fileCount; i++) {
allFilenames[i] = malloc(9);
}
EDIT: The main problem is that you only allocate memory to the double pointer. Since the double pointer points to other pointers, you need to allocate memory for those pointers as well.
You could also declare your allFilenames variable as a pointer to array instead, in which case you will only need one malloc since you only use one pointer. Like this:
char (*allFilenames)[9];
If you do this your malloc is correct as it is, though you could change sizeof(char[9]) to 9 since they are always equal.