Plug some memory leaks for truncated files