changed memory allocations to parlutions' alocate_host and free_host and also fixed leaks.