]> granicus.if.org Git - curl/commitdiff
memanalyze.pl: handle free(NULL)
authorJay Satiro <raysatiro@yahoo.com>
Mon, 9 Mar 2015 23:01:08 +0000 (19:01 -0400)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 10 Mar 2015 21:05:46 +0000 (22:05 +0100)
tests/memanalyze.pl

index 54117f8ea1ba742f6c2722e2edebae594471875a..701cf161cbb145c1fda12fba96ca7ba0ee52d06f 100755 (executable)
@@ -108,9 +108,12 @@ while(<FILE>) {
         $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}) {