For files that lack trailing newlines and match a leaking address (e.g. wchan[1]), the leaking_addresses.pl report would run together with the next line, making things look corrupted. Unconditionally remove the newline on input, and write it back out on output. [1] https://lore.kernel.org/all/20210103142726.GC30643@xsang-OptiPlex-9020/
Unified · Split
| @@ -455,8 +455,9 @@ sub parse_file · 454 unmodified lines | ||
| 455 | 455 | |
| 456 | 456 | open my $fh, "<", $file or return; |
| 457 | 457 | while ( <$fh> ) { |
| 458 | + chomp; | |
| 458 | 459 | if (may_leak_address($_)) { |
| 459 | − print $file . ': ' . $_; | |
| 460 | + printf("$file: $_\n"); | |
| 460 | 461 | } |
| 461 | 462 | } |
| 462 | 463 | close $fh; |