Fix memory leak in error path.

OK from miod@