strbuf_addf(&sb, "%s/logs", gitdir);
- diter = dir_iterator_begin(sb.buf);
- if(!diter)
+ diter = dir_iterator_begin(sb.buf, 0);
+ if (!diter) {
+ strbuf_release(&sb);
return empty_ref_iterator_begin();
+ }
iter = xcalloc(1, sizeof(*iter));
ref_iterator = &iter->base;