Do not pass size==0 unless the slot has been created before. This returns EINVAL. Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx> --- api/memmap.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/api/memmap.cc b/api/memmap.cc index c625852..041e84a 100644 --- a/api/memmap.cc +++ b/api/memmap.cc @@ -11,11 +11,16 @@ mem_slot::mem_slot(mem_map& map, uint64_t gpa, uint64_t size, void* hva) , _log() { map._free_slots.pop(); - update(); + if (_size) { + update(); + } } mem_slot::~mem_slot() { + if (!_size) { + return; + } _size = 0; try { update(); @@ -35,7 +40,9 @@ void mem_slot::set_dirty_logging(bool enabled) } else { _log.resize(0); } - update(); + if (_size) { + update(); + } } } -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html