memanalyze.pl: handle free(NULL)
This commit is contained in:
parent
e424a1b3e7
commit
f39b1c0801
@ -108,9 +108,12 @@ while(<FILE>) {
|
|||||||
$linenum = $2;
|
$linenum = $2;
|
||||||
$function = $3;
|
$function = $3;
|
||||||
|
|
||||||
if($function =~ /free\(0x([0-9a-f]*)/) {
|
if($function =~ /free\((\(nil\)|0x([0-9a-f]*))/) {
|
||||||
$addr = $1;
|
$addr = $2;
|
||||||
if(!exists $sizeataddr{$addr}) {
|
if($1 eq "(nil)") {
|
||||||
|
; # do nothing when free(NULL)
|
||||||
|
}
|
||||||
|
elsif(!exists $sizeataddr{$addr}) {
|
||||||
print "FREE ERROR: No memory allocated: $line\n";
|
print "FREE ERROR: No memory allocated: $line\n";
|
||||||
}
|
}
|
||||||
elsif(-1 == $sizeataddr{$addr}) {
|
elsif(-1 == $sizeataddr{$addr}) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user