path: root/sha1_name.c
diff options
authorBrandon Casey <>2009-07-16 21:25:19 (GMT)
committerJunio C Hamano <>2009-07-16 22:09:21 (GMT)
commitb45a09c4b4a80ccc6eeb0f390ab8f4eb6f31c922 (patch)
tree68ddec4a335c467bc84624b018e71259d4e5ff24 /sha1_name.c
parent9d33f7c22fda81f7be8a7aa1576e6d399d3b45ec (diff)
sha1_name.c: avoid unnecessary strbuf_release
When we fall back to a standard for_each_reflog_ent() after failing to find the nth branch switch (or if we had a short reflog) with the call to for_each_recent_reflog_ent(), we do not need to free the memory allocated for our strbuf's since a strbuf_reset() will be performed in grab_nth_branch_switch() before assigning to the entry. Plus, the strbuf_release() negates the non-zero hint we initially gave to strbuf_init() just above these lines. Signed-off-by: Brandon Casey <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'sha1_name.c')
1 files changed, 0 insertions, 2 deletions
diff --git a/sha1_name.c b/sha1_name.c
index 904bcd9..44bb62d 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -777,8 +777,6 @@ int interpret_branch_name(const char *name, struct strbuf *buf)
for_each_recent_reflog_ent("HEAD", grab_nth_branch_switch, 40960, &cb);
if (cb.cnt < nth) {
cb.cnt = 0;
- for (i = 0; i < nth; i++)
- strbuf_release(&cb.buf[i]);
for_each_reflog_ent("HEAD", grab_nth_branch_switch, &cb);
if (cb.cnt < nth)