moved malloc into child process