mirror of
https://github.com/git/git.git
synced 2026-01-25 10:03:24 +00:00
receive-pack: plug memory leak in update()
Reported via Coverity. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user