提交 d32de66a 编写于 作者: J Johannes Schindelin 提交者: Junio C Hamano

submodule_uses_worktrees(): plug memory leak

There is really no reason why we would need to hold onto the allocated
string longer than necessary.

Reported by Coverity.
Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 2e11f58f
......@@ -399,6 +399,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
......@@ -418,7 +419,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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册