hope this patch fix the memory leak reported by teoryn

Sad that I cannot reproduce the leak on my own machine, even though
my valgrind has a higher version than teoryn's