ncteisen | 58b2d85 | 2017-10-16 14:30:02 -0700 | [diff] [blame^] | 1 | #!/bin/python |
| 2 | |
| 3 | import sys |
| 4 | import re |
| 5 | |
| 6 | data = sys.stdin.readlines() |
| 7 | |
| 8 | errs = [] |
| 9 | for line in data: |
| 10 | if re.search(r'error.cc', line): |
| 11 | line = line.partition('error.cc:')[-1] |
| 12 | line = re.sub(r'\d+] ', r'', line) |
| 13 | line = line.strip().split() |
| 14 | err = line[0].strip(":") |
| 15 | if line[1] == "create": |
| 16 | assert(err not in errs) |
| 17 | errs.append(err) |
| 18 | elif line[0] == "realloc": |
| 19 | errs.remove(line[1]) |
| 20 | errs.append(line[3]) |
| 21 | elif line[1] == "1" and line[3] == "0": |
| 22 | # print line |
| 23 | # print err, errs |
| 24 | assert(err in errs) |
| 25 | errs.remove(err) |
| 26 | |
| 27 | print "leaked:", errs |