Merge pull request #1540 from ethomson/leaks

fix some leaks
add iterator for status