From c3741e4fa16328be578c451baebbf7dafc9e2230 Mon Sep 17 00:00:00 2001 From: "Ruben S. Montero" Date: Tue, 9 Jun 2015 00:21:29 +0200 Subject: [PATCH] feature #3782: Remove snapshot list if empty --- src/vm/VirtualMachine.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/vm/VirtualMachine.cc b/src/vm/VirtualMachine.cc index 1e43d1add7..72042516d7 100644 --- a/src/vm/VirtualMachine.cc +++ b/src/vm/VirtualMachine.cc @@ -4434,5 +4434,14 @@ void VirtualMachine::delete_disk_snapshot(int did, int snap_id) } it->second->delete_snapshot(snap_id); + + if (it->second->size() == 0) + { + Snapshots * tmp = it->second; + + snapshots.erase(it); + + delete tmp; + } }