summaryrefslogtreecommitdiff
path: root/reachable.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2014-10-15 22:35:12 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-10-16 17:10:37 (GMT)
commit1da1e07c835e900337714cfad6c32a8dc0b36ac3 (patch)
tree4f2e4825681dbebd1d8d91e6afb786aa07fa0f2b /reachable.c
parent46be823124bb6a6ff0e06dc19c327b599ed97c72 (diff)
downloadgit-1da1e07c835e900337714cfad6c32a8dc0b36ac3.zip
git-1da1e07c835e900337714cfad6c32a8dc0b36ac3.tar.gz
git-1da1e07c835e900337714cfad6c32a8dc0b36ac3.tar.bz2
clean up name allocation in prepare_revision_walk
When we enter prepare_revision_walk, we have zero or more entries in our "pending" array. We disconnect that array from the rev_info, and then process each entry: 1. If the entry is a commit and the --source option is in effect, we keep a pointer to the object name. 2. Otherwise, we re-add the item to the pending list with a blank name. We then throw away the old array by freeing the array itself, but do not touch the "name" field of each entry. For any items of type (2), we leak the memory associated with the name. This commit fixes that by calling object_array_clear, which handles the cleanup for us. That breaks (1), though, because it depends on the memory pointed to by the name to last forever. We can solve that by making a copy of the name. This is slightly less efficient, but it shouldn't matter in practice, as we do it only for the tip commits of the traversal. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'reachable.c')
0 files changed, 0 insertions, 0 deletions