From bf43b49a200dace98a5245e782e0831313461b31 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 14 Dec 2000 15:56:59 +0000 Subject: added socket() / sclose() checks to the memdebug system --- memanalyze.pl | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'memanalyze.pl') diff --git a/memanalyze.pl b/memanalyze.pl index 3b706af72..48fff8f27 100755 --- a/memanalyze.pl +++ b/memanalyze.pl @@ -72,6 +72,28 @@ while() { print "Not recognized input line: $function\n"; } } + # FD url.c:1282 socket() = 5 + elsif($_ =~ /^FD ([^:]*):(\d*) (.*)/) { + # generic match for the filename+linenumber + $source = $1; + $linenum = $2; + $function = $3; + + if($function =~ /socket\(\) = (\d*)/) { + $filedes{$1}=1; + $getfile{$1}="$source:$linenum"; + $openfile++; + } + elsif($function =~ /sclose\((\d*)\)/) { + if($filedes{$1} != 1) { + print "Close without open: $line\n"; + } + else { + $filedes{$1}=0; # closed now + $openfile--; + } + } + } else { print "Not recognized prefix line: $line\n"; } @@ -93,3 +115,10 @@ if($totalmem) { } } +if($openfile) { + for(keys %filedes) { + if($filedes{$_} == 1) { + print "Open file descriptor created at ".$getfile{$_}."\n"; + } + } +} -- cgit v1.2.1