diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-06-04 10:21:04 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-06-04 10:21:04 +0900 |
commit | 34bbe2edd47cf22a7af361f8ec9d41c5ec95aaac (patch) | |
tree | 2518c80fab78106a36801c02b6b2a53628fa7c82 /builtin/receive-pack.c | |
parent | Merge branch 'js/eol-on-ourselves' into maint (diff) | |
parent | checkout: fix memory leak (diff) | |
download | tgif-34bbe2edd47cf22a7af361f8ec9d41c5ec95aaac.tar.xz |
Merge branch 'js/plug-leaks' into maint
Fix memory leaks pointed out by Coverity (and people).
* js/plug-leaks: (26 commits)
checkout: fix memory leak
submodule_uses_worktrees(): plug memory leak
show_worktree(): plug memory leak
name-rev: avoid leaking memory in the `deref` case
remote: plug memory leak in match_explicit()
add_reflog_for_walk: avoid memory leak
shallow: avoid memory leak
line-log: avoid memory leak
receive-pack: plug memory leak in update()
fast-export: avoid leaking memory in handle_tag()
mktree: plug memory leaks reported by Coverity
pack-redundant: plug memory leak
setup_discovered_git_dir(): plug memory leak
setup_bare_git_dir(): help static analysis
split_commit_in_progress(): simplify & fix memory leak
checkout: fix memory leak
cat-file: fix memory leak
mailinfo & mailsplit: check for EOF while parsing
status: close file descriptor after reading git-rebase-todo
difftool: address a couple of resource/memory leaks
...
Diffstat (limited to 'builtin/receive-pack.c')
-rw-r--r-- | builtin/receive-pack.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index f96834f42c..48c07ddb65 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -986,7 +986,8 @@ static const char *update(struct command *cmd, struct shallow_info *si) { const char *name = cmd->ref_name; struct strbuf namespaced_name_buf = STRBUF_INIT; - const char *namespaced_name, *ret; + static char *namespaced_name; + const char *ret; struct object_id *old_oid = &cmd->old_oid; struct object_id *new_oid = &cmd->new_oid; @@ -997,6 +998,7 @@ static const char *update(struct command *cmd, struct shallow_info *si) } strbuf_addf(&namespaced_name_buf, "%s%s", get_git_namespace(), name); + free(namespaced_name); namespaced_name = strbuf_detach(&namespaced_name_buf, NULL); if (is_ref_checked_out(namespaced_name)) { |