policer: fix memory leak 03/34803/3
authorLeung Lai Yung <benkerbuild@gmail.com>
Mon, 27 Dec 2021 04:14:20 +0000 (04:14 +0000)
committerBeno�t Ganne <bganne@cisco.com>
Mon, 24 Jan 2022 10:24:15 +0000 (10:24 +0000)
Type: fix

policer_add_del does not free "clib_error_t*" when it is not null.

Signed-off-by: Leung Lai Yung <benkerbuild@gmail.com>
Change-Id: I00ad8e53797e46adeb1819856262bb9f3c068c63

src/vnet/policer/policer_api.c

index 1382d17..8c958e7 100644 (file)
@@ -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,