Free nested chain handles and command structures when done.
Signed-off-by: Patrick McHardy <kaber@trash.net>
{
struct netlink_ctx ctx;
- struct cmd *cmd;
+ struct cmd *cmd, *next;
- list_for_each_entry(cmd, &state.cmds, list) {
+ list_for_each_entry_safe(cmd, next, &state.cmds, list) {
memset(&ctx, 0, sizeof(ctx));
ctx.msgs = &msgs;
init_list_head(&ctx.list);
if (do_command(&ctx, cmd) < 0)
goto out;
+ list_del(&cmd->list);
+ cmd_free(cmd);
}
}
out:
'{' chain_block '}'
{
handle_merge(&$3->handle, &$2);
+ handle_free(&$2);
close_scope(state);
$$ = $3;
}