mirror of
https://github.com/curl/curl.git
synced 2025-09-10 14:12:41 +03:00
Made the complaint on free-twice errors a lot better
This commit is contained in:
parent
022315089b
commit
7822233964
|
@ -26,13 +26,17 @@ while(<STDIN>) {
|
||||||
|
|
||||||
if($function =~ /free\(0x([0-9a-f]*)/) {
|
if($function =~ /free\(0x([0-9a-f]*)/) {
|
||||||
$addr = $1;
|
$addr = $1;
|
||||||
if($sizeataddr{$addr} <= 0) {
|
if($sizeataddr{$addr} == 0) {
|
||||||
print "FREE ERROR: No memory allocated: $line\n";
|
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 {
|
else {
|
||||||
$totalmem -= $sizeataddr{$addr};
|
$totalmem -= $sizeataddr{$addr};
|
||||||
$sizeataddr{$addr}=0;
|
$sizeataddr{$addr}=-1; # set -1 to mark as freed
|
||||||
$getmem{$addr}=""; # forget after a good free()
|
$getmem{$addr}="$source:$linenum";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elsif($function =~ /malloc\((\d*)\) = 0x([0-9a-f]*)/) {
|
elsif($function =~ /malloc\((\d*)\) = 0x([0-9a-f]*)/) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user