Added malloc test.
fixed missing assignment in malloc func