mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
Merge branch 'ab/various-leak-fixes'
Leak fixes.
* ab/various-leak-fixes:
push: free_refs() the "local_refs" in set_refspecs()
push: refactor refspec_append_mapped() for subsequent leak-fix
receive-pack: release the linked "struct command *" list
grep API: plug memory leaks by freeing "header_list"
grep.c: refactor free_grep_patterns()
builtin/merge.c: free "&buf" on "Your local changes..." error
builtin/merge.c: use fixed strings, not "strbuf", fix leak
show-branch: free() allocated "head" before return
commit-graph: fix a parse_options_concat() leak
http-backend.c: fix cmd_main() memory leak, refactor reg{exec,free}()
http-backend.c: fix "dir" and "cmd_arg" leaks in cmd_main()
worktree: fix a trivial leak in prune_worktrees()
repack: fix leaks on error with "goto cleanup"
name-rev: don't xstrdup() an already dup'd string
various: add missing clear_pathspec(), fix leaks
clone: use free() instead of UNLEAK()
commit-graph: use free_commit_graph() instead of UNLEAK()
bundle.c: don't leak the "args" in the "struct child_process"
tests: mark tests as passing with SANITIZE=leak
This commit is contained in:
@@ -265,17 +265,6 @@ static int subpath_matches(const char *path, const char *filter)
|
||||
return -1;
|
||||
}
|
||||
|
||||
static const char *name_ref_abbrev(const char *refname, int shorten_unambiguous)
|
||||
{
|
||||
if (shorten_unambiguous)
|
||||
refname = shorten_unambiguous_ref(refname, 0);
|
||||
else if (skip_prefix(refname, "refs/heads/", &refname))
|
||||
; /* refname already advanced */
|
||||
else
|
||||
skip_prefix(refname, "refs/", &refname);
|
||||
return refname;
|
||||
}
|
||||
|
||||
struct name_ref_data {
|
||||
int tags_only;
|
||||
int name_only;
|
||||
@@ -301,11 +290,19 @@ static void add_to_tip_table(const struct object_id *oid, const char *refname,
|
||||
int shorten_unambiguous, struct commit *commit,
|
||||
timestamp_t taggerdate, int from_tag, int deref)
|
||||
{
|
||||
refname = name_ref_abbrev(refname, shorten_unambiguous);
|
||||
char *short_refname = NULL;
|
||||
|
||||
if (shorten_unambiguous)
|
||||
short_refname = shorten_unambiguous_ref(refname, 0);
|
||||
else if (skip_prefix(refname, "refs/heads/", &refname))
|
||||
; /* refname already advanced */
|
||||
else
|
||||
skip_prefix(refname, "refs/", &refname);
|
||||
|
||||
ALLOC_GROW(tip_table.table, tip_table.nr + 1, tip_table.alloc);
|
||||
oidcpy(&tip_table.table[tip_table.nr].oid, oid);
|
||||
tip_table.table[tip_table.nr].refname = xstrdup(refname);
|
||||
tip_table.table[tip_table.nr].refname = short_refname ?
|
||||
short_refname : xstrdup(refname);
|
||||
tip_table.table[tip_table.nr].commit = commit;
|
||||
tip_table.table[tip_table.nr].taggerdate = taggerdate;
|
||||
tip_table.table[tip_table.nr].from_tag = from_tag;
|
||||
|
||||
Reference in New Issue
Block a user