hush_leaktool.sh 566 B

12345678910111213141516171819202122232425
  1. #!/bin/sh
  2. # hush's stderr with leak debug enabled
  3. output=output
  4. freelist=`grep 'free 0x' "$output" | cut -d' ' -f2 | sort | uniq | xargs`
  5. grep -v free "$output" >"$output.leaked"
  6. i=8
  7. list=
  8. for freed in $freelist; do
  9. list="$list -e $freed"
  10. test $((--i)) != 0 && continue
  11. echo Dropping $list
  12. grep -F -v $list <"$output.leaked" >"$output.temp"
  13. mv "$output.temp" "$output.leaked"
  14. i=8
  15. list=
  16. done
  17. if test "$list"; then
  18. echo Dropping $list
  19. grep -F -v $list <"$output.leaked" >"$output.temp"
  20. mv "$output.temp" "$output.leaked"
  21. fi