From: Daniel Stenberg Date: Fri, 19 Jan 2001 12:20:30 +0000 (+0000) Subject: Made the complaint on free-twice errors a lot better X-Git-Tag: curl-7_6-pre4~37 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7822233964cb46b69704e6637c9c6c2eb2381c94;p=curl Made the complaint on free-twice errors a lot better --- diff --git a/memanalyze.pl b/memanalyze.pl index aa6db4c81..86c967c8c 100755 --- a/memanalyze.pl +++ b/memanalyze.pl @@ -26,13 +26,17 @@ while() { if($function =~ /free\(0x([0-9a-f]*)/) { $addr = $1; - if($sizeataddr{$addr} <= 0) { + if($sizeataddr{$addr} == 0) { print "FREE ERROR: No memory allocated: $line\n"; } + elsif(-1 == $sizeataddr{$addr}) { + print "FREE ERROR: Memory freed twice: $line\n"; + print "FREE ERROR: Previously freed at: ".$getmem{$addr}."\n"; + } else { $totalmem -= $sizeataddr{$addr}; - $sizeataddr{$addr}=0; - $getmem{$addr}=""; # forget after a good free() + $sizeataddr{$addr}=-1; # set -1 to mark as freed + $getmem{$addr}="$source:$linenum"; } } elsif($function =~ /malloc\((\d*)\) = 0x([0-9a-f]*)/) {