Fix valgrind errors
Merge pull request #35 from Metaswitch/issue32_vg

[Reviewer: Andy][From: Alex] Fix valgrind errors.