Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
receive-pack: plug memory leak in update()
author
Johannes Schindelin
<johannes.schindelin@gmx.de>
Thu, 4 May 2017 13:57:55 +0000
(15:57 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 8 May 2017 03:18:20 +0000
(12:18 +0900)
Reported via Coverity.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/receive-pack.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
1efb1e9
)
diff --git
a/builtin/receive-pack.c
b/builtin/receive-pack.c
index f96834f42c9849746b64c20c84869232cbac7367..48c07ddb65930ed6fd529aed9d90da5618da678b 100644
(file)
--- 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)) {