Fixed memory leaks in command.c