Fix crash on error
Merge pull request #737 from Metaswitch/sproutlet_memleak

[No reviewer required] Fix crash on error