src/irc: Fix valgrind-related memory errors