plug a few leaks in revision walking used in describe.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Jan 10, 2007 at 22:36 UTC
94d23673e37160ee99ec1b1cd23ff3b7a79f7226
2 files changed
+6
-3
builtin-describe.c
+1
@@ -183,6 +183,7 @@ static void describe(const char *arg, int last_one)
183
cur_match->depth++;
184
if (!min_match || cur_match->depth < min_match->depth)
185
min_match = cur_match;
186
+ free_commit_list(revs.commits);
187
}
188
printf("%s-g%s\n", min_match->name->path,
189
find_unique_abbrev(cmit->object.sha1, abbrev));
revision.c
+5
-3
@@ -1121,21 +1121,23 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
1121
void prepare_revision_walk(struct rev_info *revs)
1122
{
1123
int nr = revs->pending.nr;
1124
- struct object_array_entry *list = revs->pending.objects;
1124
+ struct object_array_entry *e, *list;
1125
1126
+ e = list = revs->pending.objects;
1127
revs->pending.nr = 0;
1128
revs->pending.alloc = 0;
1129
revs->pending.objects = NULL;
1130
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);
1132
if (commit) {
1133
if (!(commit->object.flags & SEEN)) {
1134
commit->object.flags |= SEEN;
1135
insert_by_date(commit, &revs->commits);
1136
}
1137
}
1137
- list++;
1138
+ e++;
1139
}
1140
+ free(list);
1141
1142
if (revs->no_walk)
1143
return;