diff --git a/Shorewall/Perl/Shorewall/Chains.pm b/Shorewall/Perl/Shorewall/Chains.pm index 23cef3f39..4eaaeee02 100644 --- a/Shorewall/Perl/Shorewall/Chains.pm +++ b/Shorewall/Perl/Shorewall/Chains.pm @@ -762,9 +762,10 @@ sub increment_reference_count( $$ ) { sub decrement_reference_count( $$ ) { my ($toref, $chain) = @_; - if ( $toref && $toref->{referenced} && $toref->{references}{$chain} ) { + if ( $toref && $toref->{referenced} ) { + assert($toref->{references}{$chain} > 0 ); delete $toref->{references}{$chain} unless --$toref->{references}{$chain}; - delete_chain( $toref ) unless ( keys %{$toref->{references}} ); + delete_chain( $toref ) unless ( keys %{$toref->{references}} ); } }