lib/vhost: Handle realloc failure

Change-Id: I47157e33e306205fa261e65e4b99fa13c1f1148d
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
This commit is contained in:
Ziye Yang 2017-03-23 15:02:10 +08:00 committed by Daniel Verkamp
parent 1bbb43c544
commit fea78497a1

View File

@ -410,6 +410,10 @@ add_one_guest_page(struct virtio_net *dev, uint64_t guest_phys_addr,
dev->max_guest_pages *= 2;
dev->guest_pages = realloc(dev->guest_pages,
dev->max_guest_pages * sizeof(*page));
if (!dev->guest_pages) {
RTE_LOG(ERR, VHOST_CONFIG, "cannot realloc guest_pages\n");
abort();
}
}
if (dev->nr_guest_pages > 0) {