From c4f396db2484362ecb7a1c54458ad794b8d5c506 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Aug 18 2014 16:50:43 +0000 Subject: Ticket 47446 - logconv.pl memory continually grows Bug Description: Running logconv.pl without any special options continually consumes more memory. Fix Description: The last fix introduced the use of regex matches which caused the value of $1 to become undefined. When using all of the logconv cmd line switches, many undefined variable warnings were printed. This fix saves the value of $1 in a local variable so that it it not undefined by the use of subsequent regex matches. https://fedorahosted.org/389/ticket/47446 Reviewed by: mreynolds (Thanks!) --- diff --git a/ldap/admin/src/logconv.pl b/ldap/admin/src/logconv.pl index 3ca3498..0611755 100755 --- a/ldap/admin/src/logconv.pl +++ b/ldap/admin/src/logconv.pl @@ -1825,10 +1825,11 @@ sub parseLineNormal $srchCount++; if($reportStats){ inc_stats('srch',$s_stats,$m_stats); } if ($_ =~ / attrs=\"(.*)\"/i){ + my $attrlist = $1; $anyAttrs++; if ($usage =~ /r/i || $verb eq "yes"){ my $attr = $hashes->{attr}; - map { $attr->{$_}++ } split /\s/, $1; + map { $attr->{$_}++ } split /\s/, $attrlist; } } if (/ attrs=ALL/){ @@ -2271,8 +2272,9 @@ sub parseLineNormal } } if ($_ =~ /err= *([0-9]+)/i){ - if ($usage =~ /e/i || $verb eq "yes"){ $errorCode[$1]++; } - if ($1 ne "0"){ $errorCount++;} + my $errcode = $1; + if ($usage =~ /e/i || $verb eq "yes"){ $errorCode[$errcode]++; } + if ($errcode ne "0"){ $errorCount++;} else { $successCount++;} } if ($_ =~ /etime= *([0-9.]+)/ ) { @@ -2282,8 +2284,9 @@ sub parseLineNormal } if ($_ =~ / tag=101 / || $_ =~ / tag=111 / || $_ =~ / tag=100 / || $_ =~ / tag=115 /){ if ($_ =~ / nentries= *([0-9]+)/i ){ + my $nents = $1; if ($usage =~ /n/i || $verb eq "yes"){ - $hashes->{nentries}->{$1}++; + $hashes->{nentries}->{$nents}++; } } } @@ -2292,10 +2295,12 @@ sub parseLineNormal } if (m/ EXT oid=/){ $extopCount++; + my $oid; if ($_ =~ /oid=\" *([0-9\.]+)/i ){ - if ($usage =~ /x/i || $verb eq "yes"){$hashes->{oid}->{$1}++; } + $oid = $1; + if ($usage =~ /x/i || $verb eq "yes"){$hashes->{oid}->{$oid}++; } } - if ($1 && $1 eq $startTLSoid){$startTLSCount++;} + if ($oid && $oid eq $startTLSoid){$startTLSCount++;} if ($verb eq "yes"){ if ($_ =~ /conn= *([0-9A-Z]+) +op= *([0-9\-]+)/i){ $hashes->{ext_conn_op}->{"$serverRestartCount,$1,$2"}++;} }