Fixes some leaks that show up on appverifier when running vainfo. After these changes, no more leaks are reported.