Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- if [ $# -ne 2 ]; then
- echo "incorrect number of command line arguments" >&2
- exit 1
- fi
- cat $1 | while read nextLine; do
- if [ ! -r "$nextLine.in" ]; then
- echo "file not found" >&2
- exit 1
- fi
- output=`valgrind --log-fd=1 --leak-check=full --show-reachable=yes $2 < $nextLine.in`
- errorCheck=`echo "$output" | tail -1 | egrep -c '.*ERROR SUMMARY: [1-9]* .'`
- if [ $errorCheck -eq 1 ]; then
- echo "Memory leak detected: $nextLine.in"
- echo "$output"
- fi
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement