diff options
author | Phil Sutter <phil@nwl.cc> | 2021-06-11 16:46:48 +0200 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2021-06-14 13:31:07 +0200 |
commit | 97b5d4bbcac4d3237f114c1c6a57c37968ebe0fc (patch) | |
tree | db808418fb31fe1dce02cdea61d53f851fd44f68 | |
parent | 47640634cff9932784a1a96836d6c5809cc8264d (diff) |
netlink: Avoid memleak in error path of netlink_delinearize_obj()
If parsing udata fails, 'obj' has to be freed before returning to
caller.
Fixes: 293c9b114faef ("src: add comment support for objects")
Signed-off-by: Phil Sutter <phil@nwl.cc>
-rw-r--r-- | src/netlink.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/netlink.c b/src/netlink.c index be98bfb7..f2c1a4a1 100644 --- a/src/netlink.c +++ b/src/netlink.c @@ -1450,6 +1450,7 @@ struct obj *netlink_delinearize_obj(struct netlink_ctx *ctx, udata = nftnl_obj_get_data(nlo, NFTNL_OBJ_USERDATA, &ulen); if (nftnl_udata_parse(udata, ulen, obj_parse_udata_cb, ud) < 0) { netlink_io_error(ctx, NULL, "Cannot parse userdata"); + obj_free(obj); return NULL; } if (ud[NFTNL_UDATA_OBJ_COMMENT]) |