Fixed memory leaks and off by 1 error with shell.c: process_line(): tail