Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
submodule_uses_worktrees(): plug memory leak
author
Johannes Schindelin
<johannes.schindelin@gmx.de>
Thu, 4 May 2017 13:59:19 +0000
(15:59 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 8 May 2017 03:18:20 +0000
(12:18 +0900)
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>
worktree.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
2e11f58
)
diff --git
a/worktree.c
b/worktree.c
index bae787cf8d7e968e8d5118bf54f17112c0229bf5..89a81b13de38473aaa52870d80f59c247578a3a5 100644
(file)
--- a/
worktree.c
+++ b/
worktree.c
@@
-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;