update version number to 0.99.01
[nasm.git] / misc / findleak.pl
blobdbb33671f877428c7af476df59db9b5688efb5e8
1 #!/usr/bin/perl
2 # From: Ed Beroset <beroset@mindspring.com>
4 my %mem = {};
5 my %alloc = {};
6 while(<>)
8 if (/realloc\((0x[0-9a-f]+).*\).*returns \((0x[0-9a-f]+)/)
10 $mem{$1}--;
11 if ($mem{$1} != 0) {
12 print "free before alloc! $_";
14 if ($mem{$2} != 0) {
15 print "memory leak! $_";
17 $mem{$2}++;
18 $alloc{$2} = $_;
20 elsif (/free\((0x[0-9a-f]+)/)
22 $mem{$1}--;
23 if ($mem{$1} != 0) {
24 print "free before alloc! $_";
27 elsif (m/returns (0x[0-9a-f]+)/)
29 if ($mem{$1} != 0) {
30 print "memory leak! $_";
32 $mem{$1}++;
33 $alloc{$1} = $_;
36 foreach $goo (sort keys %mem)
38 if ($mem{$goo})
40 print "$mem{$goo} $alloc{$goo}";