Fix memory leak

This problem was introduced by 8189925374e7ce3819bbe88b64c7b15abac96b16
as determined by git bisect: https://gist.github.com/felixge/5567854

Fixes #471