diff options
Diffstat (limited to 'refs')
-rw-r--r-- | refs/files-backend.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/refs/files-backend.c b/refs/files-backend.c index 12290d2496..1f34b444af 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -1225,13 +1225,19 @@ static void read_loose_refs(const char *dirname, struct ref_dir *dir) struct strbuf refname; struct strbuf path = STRBUF_INIT; size_t path_baselen; + int err = 0; if (*refs->name) - strbuf_git_path_submodule(&path, refs->name, "%s", dirname); + err = strbuf_git_path_submodule(&path, refs->name, "%s", dirname); else strbuf_git_path(&path, "%s", dirname); path_baselen = path.len; + if (err) { + strbuf_release(&path); + return; + } + d = opendir(path.buf); if (!d) { strbuf_release(&path); |