Initialization of malloc and added fopen and free (Oh my... i forgot that :S )