From e5a66e48ba107cab130f5b6e2db98edde196a80c Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Tue, 19 Nov 2019 09:26:44 +0100 Subject: [PATCH] avoid cyclic reference this otherwise leaks memory Signed-off-by: Wolfgang Bumiller --- PVE/QemuServer.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index b0f98376..d661afe5 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -4907,10 +4907,12 @@ sub vmconfig_hotplug_pending { } } - my $apply_pending_cloudinit; + my ($apply_pending_cloudinit, $apply_pending_cloudinit_done); $apply_pending_cloudinit = sub { + return if $apply_pending_cloudinit_done; # once is enough + $apply_pending_cloudinit_done = 1; # once is enough + my ($key, $value) = @_; - $apply_pending_cloudinit = sub {}; # once is enough my @cloudinit_opts = keys %$confdesc_cloudinit; foreach my $opt (keys %{$conf->{pending}}) {