diff options
author | Patrick McHardy <kaber@trash.net> | 2015-03-24 11:51:45 +0000 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2015-03-25 20:47:49 +0000 |
commit | fffa3cc22b84d4fab237a6974041fe502c7b6034 (patch) | |
tree | f1460e8e170fc8fe090d6cb4fae845d552e37294 /src | |
parent | d268580568da75f953acfad54804ba7b5ab89d9f (diff) |
netlink: fix use after free in netlink_get_table()
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/netlink.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/netlink.c b/src/netlink.c index 24dda67c..f957295e 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -953,19 +953,19 @@ int netlink_get_table(struct netlink_ctx *ctx, const struct handle *h, nlt = alloc_nft_table(h); err = mnl_nft_table_get(nf_sock, nlt, 0); - nft_table_free(nlt); - if (err < 0) { netlink_io_error(ctx, loc, "Could not receive table from kernel: %s", strerror(errno)); - return err; + goto out; } ntable = netlink_delinearize_table(ctx, nlt); table->flags = ntable->flags; xfree(ntable); - return 0; +out: + nft_table_free(nlt); + return err; } int netlink_list_table(struct netlink_ctx *ctx, const struct handle *h, |