Merge branch 'sb/submodule-rm-absorb'
[gitweb.git] / worktree.c
index 726f732e5ecf92824c06b9f7a7dda82dfadf79f5..2801c6d52bdaa1fb83a0069c8d2217ea129fd6bf 100644 (file)
@@ -351,6 +351,7 @@ int submodule_uses_worktrees(const char *path)
 
        /* The env would be set for the superproject. */
        get_common_dir_noenv(&sb, submodule_gitdir);
+       free(submodule_gitdir);
 
        /*
         * The check below is only known to be good for repository format
@@ -370,7 +371,6 @@ int submodule_uses_worktrees(const char *path)
        /* See if there is any file inside the worktrees directory. */
        dir = opendir(sb.buf);
        strbuf_release(&sb);
-       free(submodule_gitdir);
 
        if (!dir)
                return 0;