Skip to content

Commit

Permalink
Merge branch 'dg/run-command-child-cleanup' into maint
Browse files Browse the repository at this point in the history
* dg/run-command-child-cleanup:
  run-command.c: fix broken list iteration in clear_child_for_cleanup
  • Loading branch information
gitster committed Sep 20, 2012
2 parents 96c2abe + bdee397 commit cc84144
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions run-command.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,14 @@ static void mark_child_for_cleanup(pid_t pid)

static void clear_child_for_cleanup(pid_t pid)
{
struct child_to_clean **last, *p;
struct child_to_clean **pp;

last = &children_to_clean;
for (p = children_to_clean; p; p = p->next) {
if (p->pid == pid) {
*last = p->next;
free(p);
for (pp = &children_to_clean; *pp; pp = &(*pp)->next) {
struct child_to_clean *clean_me = *pp;

if (clean_me->pid == pid) {
*pp = clean_me->next;
free(clean_me);
return;
}
}
Expand Down

0 comments on commit cc84144

Please sign in to comment.