Fix CID 1491200, 1491294 and 1491301: resource leaks.