aboutsummaryrefslogtreecommitdiffstats
path: root/lib/librte_vhost
diff options
context:
space:
mode:
Diffstat (limited to 'lib/librte_vhost')
-rw-r--r--lib/librte_vhost/vhost.c2
-rw-r--r--lib/librte_vhost/vhost_user.c8
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/librte_vhost/vhost.c b/lib/librte_vhost/vhost.c
index 0b19d2eb..1f565fbb 100644
--- a/lib/librte_vhost/vhost.c
+++ b/lib/librte_vhost/vhost.c
@@ -369,7 +369,7 @@ rte_vhost_get_mem_table(int vid, struct rte_vhost_memory **mem)
return -1;
size = dev->mem->nregions * sizeof(struct rte_vhost_mem_region);
- m = malloc(size);
+ m = malloc(sizeof(struct rte_vhost_memory) + size);
if (!m)
return -1;
diff --git a/lib/librte_vhost/vhost_user.c b/lib/librte_vhost/vhost_user.c
index 5c8058b6..28808815 100644
--- a/lib/librte_vhost/vhost_user.c
+++ b/lib/librte_vhost/vhost_user.c
@@ -114,6 +114,10 @@ vhost_backend_cleanup(struct virtio_net *dev)
rte_free(dev->mem);
dev->mem = NULL;
}
+
+ free(dev->guest_pages);
+ dev->guest_pages = NULL;
+
if (dev->log_addr) {
munmap((void *)(uintptr_t)dev->log_addr, dev->log_size);
dev->log_addr = 0;
@@ -238,8 +242,6 @@ numa_realloc(struct virtio_net *dev, int index)
struct vhost_virtqueue *old_vq, *vq;
int ret;
- enum {VIRTIO_RXQ, VIRTIO_TXQ, VIRTIO_QNUM};
-
old_dev = dev;
vq = old_vq = dev->virtqueue[index];
@@ -261,7 +263,7 @@ numa_realloc(struct virtio_net *dev, int index)
if (!vq)
return dev;
- memcpy(vq, old_vq, sizeof(*vq) * VIRTIO_QNUM);
+ memcpy(vq, old_vq, sizeof(*vq));
rte_free(old_vq);
}