Merge branch 'dg/run-command-child-cleanup' into maint
* dg/run-command-child-cleanup: run-command.c: fix broken list iteration in clear_child_for_cleanup
This commit is contained in:
@ -53,13 +53,14 @@ static void mark_child_for_cleanup(pid_t pid)
|
|||||||
|
|
||||||
static void clear_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 (pp = &children_to_clean; *pp; pp = &(*pp)->next) {
|
||||||
for (p = children_to_clean; p; p = p->next) {
|
struct child_to_clean *clean_me = *pp;
|
||||||
if (p->pid == pid) {
|
|
||||||
*last = p->next;
|
if (clean_me->pid == pid) {
|
||||||
free(p);
|
*pp = clean_me->next;
|
||||||
|
free(clean_me);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user