Fix memory leak.

Thanks to Brenk Cook.

OK from miod@