mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-31 13:03:02 +02:00
test: netns: Guard against "double free" when failing to setup netns
When used as a context manager, __exit__ will be called even though __enter__ might throw an exception half way through. So there is no guarantee that the instance is on the cleanup list when we get to stop().
This commit is contained in:
@@ -87,7 +87,8 @@ class IsolatedMacVlans:
|
||||
def stop(self):
|
||||
self.sleeper.kill()
|
||||
self.sleeper.wait()
|
||||
self.Instances.remove(self)
|
||||
if self in self.Instances:
|
||||
self.Instances.remove(self)
|
||||
time.sleep(0.5)
|
||||
|
||||
def __enter__(self):
|
||||
|
||||
Reference in New Issue
Block a user