plug a few leaks in revision walking used in describe.
authorJunio C Hamano <junkio@cox.net>
Thu, 11 Jan 2007 06:36:16 +0000 (22:36 -0800)
committerJunio C Hamano <junkio@cox.net>
Fri, 12 Jan 2007 02:05:53 +0000 (18:05 -0800)
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-describe.c
revision.c
index d65c7d286ddc6878a2d3936b9546839fec9ef997..a8c98cea163a28cafb9b23861bd976b6354c2def 100644 (file)
@@ -183,6 +183,7 @@ static void describe(const char *arg, int last_one)
                        cur_match->depth++;
                if (!min_match || cur_match->depth < min_match->depth)
                        min_match = cur_match;
+               free_commit_list(revs.commits);
        }
        printf("%s-g%s\n", min_match->name->path,
                   find_unique_abbrev(cmit->object.sha1, abbrev));
index 1e3b29a429e99fd04da54a3af661d07ddb870688..f2ddd95e29e5eaef2cb4beb28c34921396d94fdf 100644 (file)
@@ -1121,21 +1121,23 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
 void prepare_revision_walk(struct rev_info *revs)
 {
        int nr = revs->pending.nr;
-       struct object_array_entry *list = revs->pending.objects;
+       struct object_array_entry *e, *list;
 
+       e = list = revs->pending.objects;
        revs->pending.nr = 0;
        revs->pending.alloc = 0;
        revs->pending.objects = NULL;
        while (--nr >= 0) {
-               struct commit *commit = handle_commit(revs, list->item, list->name);
+               struct commit *commit = handle_commit(revs, e->item, e->name);
                if (commit) {
                        if (!(commit->object.flags & SEEN)) {
                                commit->object.flags |= SEEN;
                                insert_by_date(commit, &revs->commits);
                        }
                }
-               list++;
+               e++;
        }
+       free(list);
 
        if (revs->no_walk)
                return;