Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix use after free.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 11 Apr 2022 12:38:55 +0000 (14:38 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 11 Apr 2022 13:18:49 +0000 (15:18 +0200)
src/kernel/resource/VirtualMachineImpl.cpp

index 521b1d7..9288d0b 100644 (file)
@@ -214,10 +214,12 @@ void VirtualMachineImpl::vm_destroy()
 
   // VM uses the host's netpoint, clean but don't destroy it
   get_iface()->set_netpoint(nullptr);
+  // Take a temporary copy to delete iface safely after impl is destroy'ed
+  const auto* iface = get_iface();
   // calls the HostImpl() destroy, it'll delete the impl object
   destroy();
 
-  delete piface_;
+  delete iface;
 }
 
 void VirtualMachineImpl::start()