rte_security_session_destroy should return -EINVAL is session is NULL, but segfaults because of rte_mempool_from_obj(NULL) call.
Fixes: c261d1431bd8 ("security: introduce security API and framework") Cc: sta...@dpdk.org Signed-off-by: Radu Nicolau <radu.nico...@intel.com> --- lib/librte_security/rte_security.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/librte_security/rte_security.c b/lib/librte_security/rte_security.c index 1e559c9..f862e94 100644 --- a/lib/librte_security/rte_security.c +++ b/lib/librte_security/rte_security.c @@ -91,7 +91,6 @@ rte_security_session_destroy(struct rte_security_ctx *instance, struct rte_security_session *sess) { int ret; - struct rte_mempool *mp = rte_mempool_from_obj(sess); RTE_FUNC_PTR_OR_ERR_RET(*instance->ops->session_destroy, -ENOTSUP); @@ -100,7 +99,7 @@ rte_security_session_destroy(struct rte_security_ctx *instance, ret = instance->ops->session_destroy(instance->device, sess); if (!ret) - rte_mempool_put(mp, (void *)sess); + rte_mempool_put(rte_mempool_from_obj(sess), (void *)sess); return ret; } -- 2.7.5