From 300d9319221814e7b1f2b7e6354f8602ca60449d Mon Sep 17 00:00:00 2001 From: Tom Eastep Date: Wed, 16 Feb 2011 13:16:42 -0800 Subject: [PATCH] Assert correctness in decrement_reference_count() --- Shorewall/Perl/Shorewall/Chains.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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}} ); } }