Gérald Colangelo <gerald.colangelo@xxxxxxxxx> wrote: > +cleanup_fail: > + stop = pi; > + llist_for_each_entry(pi, &stack->list, list) { > + if (pi == stop) > + /* the one that failed, stops the cleanup here */ > + break; > + if (!pi->plugin->stop) > + continue; > + ret = pi->plugin->stop(pi); > + if (ret < 0) { > + ulogd_log(ULOGD_ERROR, > + "error stopping `%s'\n", > + pi->id); > + } > + } > + return -1; Looks good, but I think you also need to add a second loop to free() the stack elements, as done in stop_pluginstances().