Fix memory leak in OSX and linux callstack capture code that was added in previous commit, reported by Valgrind.