Imported Upstream version 7.48.0
[platform/upstream/curl.git] / tests / memanalyze.pl
index 54117f8..35d1c7e 100755 (executable)
@@ -10,7 +10,7 @@
 #
 # This software is licensed as described in the file COPYING, which
 # you should have received as part of this distribution. The terms
-# are also available at http://curl.haxx.se/docs/copyright.html.
+# are also available at https://curl.haxx.se/docs/copyright.html.
 #
 # You may opt to use, copy, modify, merge, publish, distribute and/or sell
 # copies of the Software, and permit persons to whom the Software is
@@ -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}) {