From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [PATCH] fix memleak from tree pathspec in git-blame
Date: Mon, 03 Sep 2007 23:54:19 -0700 [thread overview]
Message-ID: <7vir6q7wf8.fsf@gitster.siamese.dyndns.org> (raw)
We repeatedly run diff-tree while finding code movements. The
pathspec data is changed into a list of paths and their lengths
for quicker access by diff_tree_setup_paths(), and you need to
release the extra memory when you are done using that pathspec
data.
Not releasing it is not a problem for "git log -- path" (or its
plumbing equivalent "git rev-list -- paths"), because the
pathspec never changes during the traversal, but it was
noticeable for blame especially with -C -C.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
builtin-blame.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/builtin-blame.c b/builtin-blame.c
index dc88a95..aace08c 100644
--- a/builtin-blame.c
+++ b/builtin-blame.c
@@ -380,6 +380,7 @@ static struct origin *find_origin(struct scoreboard *sb,
}
}
diff_flush(&diff_opts);
+ diff_tree_release_paths(&diff_opts);
if (porigin) {
/*
* Create a freestanding copy that is not part of
@@ -436,6 +437,7 @@ static struct origin *find_rename(struct scoreboard *sb,
}
}
diff_flush(&diff_opts);
+ diff_tree_release_paths(&diff_opts);
return porigin;
}
@@ -1157,6 +1159,7 @@ static int find_copy_in_parent(struct scoreboard *sb,
}
}
diff_flush(&diff_opts);
+ diff_tree_release_paths(&diff_opts);
return retval;
}
reply other threads:[~2007-09-04 6:54 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vir6q7wf8.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).