diff options
author | Rasmus Villemoes <linux@rasmusvillemoes.dk> | 2017-06-08 08:59:22 (GMT) |
---|---|---|
committer | Rasmus Villemoes <linux@rasmusvillemoes.dk> | 2017-06-08 08:59:22 (GMT) |
commit | 2fda8661fd55e747d44974054b73bb66153aeb59 (patch) | |
tree | 38534500880a066ba324b46ab6ad9fbc0d3760e9 /lib/route | |
parent | 8d807b215f1ffc8b2705e6356f7450a9fcc602d1 (diff) | |
download | libnl-2fda8661fd55e747d44974054b73bb66153aeb59.zip libnl-2fda8661fd55e747d44974054b73bb66153aeb59.tar.gz libnl-2fda8661fd55e747d44974054b73bb66153aeb59.tar.bz2 |
lib/route/cls/u32.c: remove pointless nl_data_append calls
Increasing the size of the u->cu_selector item by the size of a struct
tc_u32_key (i.e., making the flexible array member sel->keys one element
bigger) is pointless when one doesn't update sel->nkeys or otherwise
records the increased size, so these are effectively memory leaks.
Diffstat (limited to 'lib/route')
-rw-r--r-- | lib/route/cls/u32.c | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/lib/route/cls/u32.c b/lib/route/cls/u32.c index 087797e..6b2c66d 100644 --- a/lib/route/cls/u32.c +++ b/lib/route/cls/u32.c @@ -469,7 +469,6 @@ int rtnl_u32_set_hashmask(struct rtnl_cls *cls, uint32_t hashmask, uint32_t offs { struct rtnl_u32 *u; struct tc_u32_sel *sel; - int err; hashmask = htonl(hashmask); @@ -480,12 +479,6 @@ int rtnl_u32_set_hashmask(struct rtnl_cls *cls, uint32_t hashmask, uint32_t offs if (!sel) return -NLE_NOMEM; - err = nl_data_append(u->cu_selector, NULL, sizeof(struct tc_u32_key)); - if(err < 0) - return err; - - sel = u32_selector(u); - sel->hmask = hashmask; sel->hoff = offset; return 0; @@ -495,7 +488,6 @@ int rtnl_u32_set_selector(struct rtnl_cls *cls, int offoff, uint32_t offmask, ch { struct rtnl_u32 *u; struct tc_u32_sel *sel; - int err; offmask = ntohs(offmask); @@ -506,12 +498,6 @@ int rtnl_u32_set_selector(struct rtnl_cls *cls, int offoff, uint32_t offmask, ch if (!sel) return -NLE_NOMEM; - err = nl_data_append(u->cu_selector, NULL, sizeof(struct tc_u32_key)); - if(err < 0) - return err; - - sel = u32_selector(u); - sel->offoff = offoff; sel->offmask = offmask; sel->offshift = offshift; @@ -525,7 +511,6 @@ int rtnl_u32_set_cls_terminal(struct rtnl_cls *cls) { struct rtnl_u32 *u; struct tc_u32_sel *sel; - int err; if (!(u = (struct rtnl_u32 *) rtnl_tc_data(TC_CAST(cls)))) return -NLE_NOMEM; @@ -534,12 +519,6 @@ int rtnl_u32_set_cls_terminal(struct rtnl_cls *cls) if (!sel) return -NLE_NOMEM; - err = nl_data_append(u->cu_selector, NULL, sizeof(struct tc_u32_key)); - if(err < 0) - return err; - - sel = u32_selector(u); - sel->flags |= TC_U32_TERMINAL; return 0; } |