Fixed memory leak in read_port_command