From 01a55860c62d2ddeb03fbd3d7a931a757d29f2da Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Mon, 16 Dec 2024 16:44:59 +0100 Subject: [PATCH] libnetwork/drivers/bridge: setupIPChains: fix defer checking wrong err The output variable was renamed in 0503cf2510ba77563ae4f731cc9ca599d45b7e3a, but that commit failed to change this defer, which was now checking the wrong error. Signed-off-by: Sebastiaan van Stijn --- libnetwork/drivers/bridge/setup_ip_tables_linux.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libnetwork/drivers/bridge/setup_ip_tables_linux.go b/libnetwork/drivers/bridge/setup_ip_tables_linux.go index 17e0cc643ed97..ab898b1f8c199 100644 --- a/libnetwork/drivers/bridge/setup_ip_tables_linux.go +++ b/libnetwork/drivers/bridge/setup_ip_tables_linux.go @@ -72,7 +72,7 @@ func setupIPChains(config configuration, version iptables.IPVersion) (natChain * return nil, nil, nil, nil, fmt.Errorf("failed to create FILTER chain %s: %v", DockerChain, err) } defer func() { - if err != nil { + if retErr != nil { if err := iptable.RemoveExistingChain(DockerChain, iptables.Filter); err != nil { log.G(context.TODO()).Warnf("failed on removing iptables FILTER chain %s on cleanup: %v", DockerChain, err) }