Fix memory leak.

(From Martin Brejcha)

OK from tedu@, miod@ and deraadt@