read-cache.c: fix index memory allocation