init output parameter in walk_dir()
diff --git a/lib/fileindex.c b/lib/fileindex.c
index b24976a..155c46e 100644
--- a/lib/fileindex.c
+++ b/lib/fileindex.c
@@ -767,6 +767,8 @@ walk_dir(struct got_pathlist_entry **next, struct got_fileindex *fileindex,
const struct got_error *err = NULL;
struct dirent *de = dle->data;
+ *next = NULL;
+
if (de->d_type == DT_DIR) {
char *subpath;
char *subdirpath;