api: fix sock reg passing on read event

Type: fix

Change-Id: I383242e04a114b69fe247d912842be3560e96c10
Signed-off-by: Florin Coras <fcoras@cisco.com>
diff --git a/src/vlibmemory/vlib_api.c b/src/vlibmemory/vlib_api.c
index 05652fa..5494da3 100644
--- a/src/vlibmemory/vlib_api.c
+++ b/src/vlibmemory/vlib_api.c
@@ -385,10 +385,16 @@
 	case SOCKET_READ_EVENT:
 	  for (i = 0; i < vec_len (event_data); i++)
 	    {
+	      vl_api_registration_t *regp;
+
 	      a = pool_elt_at_index (socket_main.process_args, event_data[i]);
-	      vl_socket_process_api_msg (a->clib_file, a->regp,
-					 (i8 *) a->data);
-	      a = pool_elt_at_index (socket_main.process_args, event_data[i]);
+	      regp = vl_socket_get_registration (a->reg_index);
+	      if (regp)
+		{
+		  vl_socket_process_api_msg (regp, (i8 *) a->data);
+		  a = pool_elt_at_index (socket_main.process_args,
+					 event_data[i]);
+		}
 	      vec_free (a->data);
 	      pool_put (socket_main.process_args, a);
 	    }