shell.c malloc code improved