--- branches/KDE/4.2/kdelibs/kinit/kinit.cpp 2009/04/18 19:34:41 955904 +++ branches/KDE/4.2/kdelibs/kinit/kinit.cpp 2009/04/19 10:43:38 956037 @@ -254,10 +254,9 @@ /* Notify wrapper program that the child it started has finished. */ static void child_died(pid_t exit_pid, int exit_status) { - struct child *child = children; - struct child *prev = NULL; + struct child *child, **childptr = &children; - while (child) + while ((child = *childptr)) { if (child->pid == exit_pid) { @@ -272,20 +271,12 @@ write(child->sock, request_data, request_header.arg_length); close(child->sock); - if (prev) - { - prev->next = child->next; - } - else - { - child = NULL; - } + *childptr = child->next; free(child); return; } - prev = child; - child = child->next; + childptr = &child->next; } }