Denis Vlasenko | f962a03 | 2007-11-23 12:50:54 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # hush's stderr with leak debug enabled |
| 4 | output=output |
| 5 | |
| 6 | freelist=`grep 'free 0x' "$output" | cut -d' ' -f2 | sort | uniq | xargs` |
| 7 | |
Denis Vlasenko | 14725f8 | 2009-04-08 16:46:45 +0000 | [diff] [blame] | 8 | grep -v free "$output" >"$output.leaked" |
Denis Vlasenko | dcd78c4 | 2009-04-19 23:07:51 +0000 | [diff] [blame] | 9 | |
| 10 | i=8 |
| 11 | list= |
Denis Vlasenko | f962a03 | 2007-11-23 12:50:54 +0000 | [diff] [blame] | 12 | for freed in $freelist; do |
Denis Vlasenko | dcd78c4 | 2009-04-19 23:07:51 +0000 | [diff] [blame] | 13 | list="$list -e $freed" |
| 14 | test $((--i)) != 0 && continue |
| 15 | echo Dropping $list |
| 16 | grep -F -v $list <"$output.leaked" >"$output.temp" |
Denis Vlasenko | 14725f8 | 2009-04-08 16:46:45 +0000 | [diff] [blame] | 17 | mv "$output.temp" "$output.leaked" |
Denis Vlasenko | dcd78c4 | 2009-04-19 23:07:51 +0000 | [diff] [blame] | 18 | i=8 |
| 19 | list= |
Denis Vlasenko | f962a03 | 2007-11-23 12:50:54 +0000 | [diff] [blame] | 20 | done |
Denis Vlasenko | dcd78c4 | 2009-04-19 23:07:51 +0000 | [diff] [blame] | 21 | if test "$list"; then |
| 22 | echo Dropping $list |
| 23 | grep -F -v $list <"$output.leaked" >"$output.temp" |
| 24 | mv "$output.temp" "$output.leaked" |
| 25 | fi |