Skip to content

Commit 94d2367

Browse files
author
Junio C Hamano
committed
plug a few leaks in revision walking used in describe.
Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 80dbae0 commit 94d2367

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

builtin-describe.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ static void describe(const char *arg, int last_one)
183183
cur_match->depth++;
184184
if (!min_match || cur_match->depth < min_match->depth)
185185
min_match = cur_match;
186+
free_commit_list(revs.commits);
186187
}
187188
printf("%s-g%s\n", min_match->name->path,
188189
find_unique_abbrev(cmit->object.sha1, abbrev));

revision.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,21 +1121,23 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
11211121
void prepare_revision_walk(struct rev_info *revs)
11221122
{
11231123
int nr = revs->pending.nr;
1124-
struct object_array_entry *list = revs->pending.objects;
1124+
struct object_array_entry *e, *list;
11251125

1126+
e = list = revs->pending.objects;
11261127
revs->pending.nr = 0;
11271128
revs->pending.alloc = 0;
11281129
revs->pending.objects = NULL;
11291130
while (--nr >= 0) {
1130-
struct commit *commit = handle_commit(revs, list->item, list->name);
1131+
struct commit *commit = handle_commit(revs, e->item, e->name);
11311132
if (commit) {
11321133
if (!(commit->object.flags & SEEN)) {
11331134
commit->object.flags |= SEEN;
11341135
insert_by_date(commit, &revs->commits);
11351136
}
11361137
}
1137-
list++;
1138+
e++;
11381139
}
1140+
free(list);
11391141

11401142
if (revs->no_walk)
11411143
return;

0 commit comments

Comments
 (0)