Clean up message parsing from stdin

Remove unnecessary memory allocation.