fixed two mallocs not being deallocated