I keep passing in and returning the dirs_later_array. When I get to \"new_size=...\" in the else block, I end up with new_size of 2 the second time around. So far so good.
Your sizeof(struct dirs_later*) should be changed to sizeof(struct dirs_later) - as before!
Also the sizeof is a compile time feature. You need a structure like this to hold the size
struct my_dirs
struct dirs_later *dirs;
int size;
};
Initialise it like this
struct my_dirs directories;
directories.size = 0;
directories.dirs = NULL;
Then to add (note realloc can take NULL as a parameter
directories.dirs = realloc(directories.dirs,
(++directories.size) * sizeof(struct dirs_later));
This would also simplify your code.