Merge branch 'kn/for-each-branch'
[gitweb.git] / upload-pack.c
index 89e832b64a0548ec79802dfc6911eff9f5c353be..d0bc3ca07ab1b005884c80901ea8dee04452b71a 100644 (file)
@@ -316,10 +316,8 @@ static int reachable(struct commit *want)
 
        commit_list_insert_by_date(want, &work);
        while (work) {
-               struct commit_list *list = work->next;
-               struct commit *commit = work->item;
-               free(work);
-               work = list;
+               struct commit_list *list;
+               struct commit *commit = pop_commit(&work);
 
                if (commit->object.flags & THEY_HAVE) {
                        want->object.flags |= COMMON_KNOWN;