summaryrefslogtreecommitdiffstats
path: root/src/netlink.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2015-01-11 07:54:55 +0000
committerPatrick McHardy <kaber@trash.net>2015-01-11 07:54:55 +0000
commite89786c29156e851619f9d827944649c82d1792b (patch)
tree6def2be5c4a870c2aa5ee490e9ac396e246f2456 /src/netlink.c
parent226b6ab5bd89bd143f5e6c11253c3d98ce5449a3 (diff)
netlink: fix memory leaks
Fix two memory leaks in netlink event monitor. Also fix a leak related to all sets, the ->init expression is not freed. Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'src/netlink.c')
-rw-r--r--src/netlink.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/netlink.c b/src/netlink.c
index feaea19a..53473729 100644
--- a/src/netlink.c
+++ b/src/netlink.c
@@ -1724,8 +1724,10 @@ static int netlink_events_set_cb(const struct nlmsghdr *nlh, int type,
case NFT_MSG_NEWSET:
printf("add ");
set = netlink_delinearize_set(monh->ctx, nls);
- if (set == NULL)
+ if (set == NULL) {
+ nft_set_free(nls);
return MNL_CB_ERROR;
+ }
set_print_plain(set);
set_free(set);
printf("\n");
@@ -1940,6 +1942,7 @@ static void netlink_events_cache_addset(struct netlink_mon_handler *monh,
t = table_lookup(&s->handle);
if (t == NULL) {
fprintf(stderr, "W: Unable to cache set: table not found.\n");
+ set_free(s);
goto out;
}