From: Jay Satiro Date: Mon, 9 Mar 2015 23:01:08 +0000 (-0400) Subject: memanalyze.pl: handle free(NULL) X-Git-Tag: curl-7_42_0~170 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f39b1c080129c01c8204d3a5a40aad038c7a57f3;p=thirdparty%2Fcurl.git memanalyze.pl: handle free(NULL) --- diff --git a/tests/memanalyze.pl b/tests/memanalyze.pl index 54117f8ea1..701cf161cb 100755 --- a/tests/memanalyze.pl +++ b/tests/memanalyze.pl @@ -108,9 +108,12 @@ while() { $linenum = $2; $function = $3; - if($function =~ /free\(0x([0-9a-f]*)/) { - $addr = $1; - if(!exists $sizeataddr{$addr}) { + if($function =~ /free\((\(nil\)|0x([0-9a-f]*))/) { + $addr = $2; + if($1 eq "(nil)") { + ; # do nothing when free(NULL) + } + elsif(!exists $sizeataddr{$addr}) { print "FREE ERROR: No memory allocated: $line\n"; } elsif(-1 == $sizeataddr{$addr}) {