summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorDekel Peled <dekelp@mellanox.com>2018-10-29 18:09:10 +0200
committerFerruh Yigit <ferruh.yigit@intel.com>2018-11-05 15:01:25 +0100
commit7199088f9dc1087b1d89797e174f7f6a0e51bf2e (patch)
tree3b67d46eb6fe18232838bf27921954c66e70ed7a /drivers
parent5db1684e7593c6fc8769b19765c8c6b9d4697f45 (diff)
downloaddpdk-7199088f9dc1087b1d89797e174f7f6a0e51bf2e.zip
dpdk-7199088f9dc1087b1d89797e174f7f6a0e51bf2e.tar.gz
dpdk-7199088f9dc1087b1d89797e174f7f6a0e51bf2e.tar.xz
net/mlx5: fix memory leak on Direct Verbs error
Add freeing of allocated memory before exiting on mlx5dv error. Fixes: fc2c498ccb94 ("net/mlx5: add Direct Verbs translate items") Signed-off-by: Dekel Peled <dekelp@mellanox.com> Acked-by: Yongseok Koh <yskoh@mellanox.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/mlx5/mlx5_flow_dv.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 8f729f4..0e1f715 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -1203,10 +1203,12 @@ flow_dv_matcher_register(struct rte_eth_dev *dev,
dv_attr.flags |= IBV_FLOW_ATTR_FLAGS_EGRESS;
cache_matcher->matcher_object =
mlx5_glue->dv_create_flow_matcher(priv->ctx, &dv_attr);
- if (!cache_matcher->matcher_object)
+ if (!cache_matcher->matcher_object) {
+ rte_free(cache_matcher);
return rte_flow_error_set(error, ENOMEM,
RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
NULL, "cannot create matcher");
+ }
rte_atomic32_inc(&cache_matcher->refcnt);
LIST_INSERT_HEAD(&priv->matchers, cache_matcher, next);
dev_flow->dv.matcher = cache_matcher;