8 my ($file, $func, $lno, $name, $size, $addr, $type);
9 if ($line =~ m/^.*\((.*):(.*)\,l\. (\d+) .* k(.*) '(.*)': (\d+) at (.*) \(tot .*$/) {
17 printf("%8s %6d bytes at %s called %s (%s:%s:%d)\n", $type, $size,
18 $addr, $name, $file, $func, $lno);
23 if ($type eq 'malloced') {
24 $memory->{$addr}->{name} = $name;
25 $memory->{$addr}->{size} = $size;
26 $memory->{$addr}->{file} = $file;
27 $memory->{$addr}->{func} = $func;
28 $memory->{$addr}->{lno} = $lno;
29 $memory->{$addr}->{debug_line} = $debug_line;
31 if (!defined($memory->{$addr})) {
32 print "*** Free without malloc ($size bytes at $addr, $file:$func:$lno)\n";
35 my ($oldname, $oldsize, $oldfile, $oldfunc, $oldlno) = $memory->{$addr};
37 if ($memory->{$addr}->{size} != $size) {
38 print "*** Free different size ($memory->{$addr}->{size} alloced, $size freed).\n";
39 print " malloc at $memory->{$addr}->{file}:$memory->{$addr}->{func}:$memory->{$addr}->{lno}, free at $file:$func:$lno\n";
43 delete $memory->{$addr};
48 foreach $key (keys(%{$memory})) {
49 my ($oldname, $oldsize, $oldfile, $oldfunc, $oldlno) = $memory->{$key};
50 print "*** Leak: $memory->{$key}->{size} bytes allocated at $key ($memory->{$key}->{file}:$memory->{$key}->{func}:$memory->{$key}->{lno}, debug file line $memory->{$key}->{debug_line})\n";