vcl: fix api detach if attach failed

Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Idd1df83bb01951c2455b23c08e3cc1fcd9b91064
diff --git a/src/vcl/vcl_private.c b/src/vcl/vcl_private.c
index 95cc0bf..589380d 100644
--- a/src/vcl/vcl_private.c
+++ b/src/vcl/vcl_private.c
@@ -138,6 +138,9 @@
 void
 vcl_api_app_worker_del (vcl_worker_t * wrk)
 {
+  if (wrk->api_client_handle == ~0)
+    return;
+
   if (vcm->cfg.vpp_app_socket_api)
     return vcl_sapi_app_worker_del (wrk);
 
@@ -249,6 +252,7 @@
 
   wrk = vcl_worker_alloc ();
   vcl_set_worker_index (wrk->wrk_index);
+  wrk->api_client_handle = ~0;
   wrk->thread_id = pthread_self ();
   wrk->current_pid = getpid ();