diff options
author | Patrick McHardy <kaber@trash.net> | 2009-03-20 17:42:55 +0100 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2009-03-20 17:42:55 +0100 |
commit | fc42681eb5872c1ddc3008b35c7c662a46efe8bb (patch) | |
tree | 07dc933c4b5c2ca168f671c4550f0abc9dd02f71 /src/main.c | |
parent | 7feffa0ed35e4125f272edded092b890234a794b (diff) |
Fix some memory leaks
Free nested chain handles and command structures when done.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -183,14 +183,16 @@ int main(int argc, char * const *argv) { 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: |