This patch fixes the segfault issue in the case vhost receives
new VHOST_SET_MEM_TABLE message without VHOST_VRING_GET_VRING_BASE
(which we uses as the stop message).
Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: Tommy Long <thomas.long@intel.com>
if (dev == NULL)
return -1;
if (dev == NULL)
return -1;
+ /* Remove from the data plane. */
+ if (dev->flags & VIRTIO_DEV_RUNNING)
+ notify_ops->destroy_device(dev);
+
if (dev->mem) {
free_mem_region(dev);
free(dev->mem);
if (dev->mem) {
free_mem_region(dev);
free(dev->mem);