From afe31562a1ed873bee8e1abb3b18df27d1a09ba3 Mon Sep 17 00:00:00 2001 From: Leung Lai Yung Date: Mon, 27 Dec 2021 04:14:20 +0000 Subject: policer: fix memory leak Type: fix policer_add_del does not free "clib_error_t*" when it is not null. Signed-off-by: Leung Lai Yung Change-Id: I00ad8e53797e46adeb1819856262bb9f3c068c63 --- src/vnet/policer/policer_api.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/vnet/policer/policer_api.c b/src/vnet/policer/policer_api.c index 1382d17e2de..8c958e79676 100644 --- a/src/vnet/policer/policer_api.c +++ b/src/vnet/policer/policer_api.c @@ -67,7 +67,10 @@ vl_api_policer_add_del_t_handler (vl_api_policer_add_del_t * mp) error = policer_add_del (vm, name, &cfg, &policer_index, mp->is_add); if (error) - rv = VNET_API_ERROR_UNSPECIFIED; + { + rv = VNET_API_ERROR_UNSPECIFIED; + clib_error_free (error); + } /* *INDENT-OFF* */ REPLY_MACRO2(VL_API_POLICER_ADD_DEL_REPLY, -- cgit 1.2.3-korg