Flow subscription parsing allocates metadata for create and validate.
The create callback leaks it when rule allocation or subscription fails,
and the validate callback never frees it.
Release the metadata on both create failure paths and after validation.
Fixes: 7b902af49947 ("net/iavf: support flow subscription rule")
Cc: [email protected]
Signed-off-by: Anatoly Burakov <[email protected]>
---
drivers/net/intel/iavf/iavf_fsub.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/intel/iavf/iavf_fsub.c
b/drivers/net/intel/iavf/iavf_fsub.c
index 4b2e40af3c0..8afbb698141 100644
--- a/drivers/net/intel/iavf/iavf_fsub.c
+++ b/drivers/net/intel/iavf/iavf_fsub.c
@@ -81,7 +81,7 @@ iavf_fsub_create(struct iavf_adapter *ad, struct rte_flow
*flow,
rte_flow_error_set(error, ENOMEM,
RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
"Failed to allocate memory for fsub rule");
- return -rte_errno;
+ goto free_entry;
}
ret = iavf_flow_sub(ad, filter);
@@ -99,6 +99,7 @@ iavf_fsub_create(struct iavf_adapter *ad, struct rte_flow
*flow,
return ret;
free_entry:
+ rte_free(meta);
rte_free(rule);
return -rte_errno;
}
@@ -133,6 +134,7 @@ iavf_fsub_validation(struct iavf_adapter *ad,
int ret;
ret = iavf_flow_sub_check(ad, filter);
+ rte_free(filter);
if (ret) {
rte_flow_error_set(error, -ret,
RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
--
2.52.0