Add free() for remaining memory leaks