Merge branch 'jk/fix-remote-curl-url-wo-proto'
[gitweb.git] / refs / files-backend.c
index 12290d249643b5aaab18961ca91637910d0d7261..1f34b444af8dd5fbbacc67f0a13510005225c6cc 100644 (file)
@@ -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);