unittest: fix coverity 274736 40/36940/2
authorAndrew Yourtchenko <ayourtch@gmail.com>
Thu, 18 Aug 2022 12:30:20 +0000 (12:30 +0000)
committerMatthew Smith <mgsmith@netgate.com>
Thu, 18 Aug 2022 23:22:28 +0000 (23:22 +0000)
Free up the vapi context in case of failure.

Type: fix
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
Change-Id: I4f64e8718014d714f1b82877e69d2354b5fa44fb

src/plugins/unittest/api_test.c

index 4bed50c..515bafe 100644 (file)
@@ -38,6 +38,7 @@ connect_to_vpp (void)
                             true) != VAPI_OK)
     {
       clib_warning ("vapi_connect failed");
+      vapi_ctx_free (ctx);
       return 0;
     }
   return ctx;