lib/message.cc: fix Coverity finding (use after free)