#1379: fix memory leaks on exceptions