[Reviewer: Alex] Fix memory leak

Fixes https://github.com/Metaswitch/ralf/issues/54.