1
0
mirror of https://github.com/git/git.git synced 2024-09-21 08:32:02 +02:00

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: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Johannes Schindelin 2017-05-04 15:59:19 +02:00 committed by Junio C Hamano
parent 2e11f58fa6
commit d32de66a07

View File

@ -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;