api: fix free socket process args
[vpp.git] / src / vlibmemory / memory_api.c
index 34fd956..42d1ee0 100644 (file)
@@ -210,6 +210,7 @@ vl_api_memclnt_create_t_handler (vl_api_memclnt_create_t * mp)
   regp->clib_file_index = am->shmem_hdr->clib_file_index;
 
   q = regp->vl_input_queue = (svm_queue_t *) (uword) mp->input_queue;
+  VL_MSG_API_SVM_QUEUE_UNPOISON (q);
 
   regp->name = format (0, "%s", mp->name);
   vec_add1 (regp->name, 0);
@@ -666,14 +667,18 @@ vl_mem_api_dead_client_scan (api_main_t * am, vl_shmem_hdr_t * shm, f64 now)
                        vec_delete (am->vlib_private_rps, 1, i);
                        goto found;
                      }
+                 svm_pop_heap (oldheap);
                  clib_warning ("private rp %llx AWOL", dead_rp);
+                 oldheap = svm_push_data_heap (svm);
 
                found:
                  /* Kill it, accounting for the memfd header page */
+                 svm_pop_heap (oldheap);
                  if (munmap ((void *) virtual_base, virtual_size) < 0)
                    clib_unix_warning ("munmap");
                  /* Reset the queue-length-address cache */
                  vec_reset_length (vl_api_queue_cursizes);
+                 oldheap = svm_push_data_heap (svm);
                }
              else
                {
@@ -709,6 +714,7 @@ void_mem_api_handle_msg_i (api_main_t * am, vlib_main_t * vm,
   uword mp;
   if (!svm_queue_sub2 (q, (u8 *) & mp))
     {
+      VL_MSG_API_UNPOISON ((void *) mp);
       vl_msg_api_handler_with_vm_node (am, (void *) mp, vm, node);
       return 0;
     }