Revert "Corrected several static analysis issues related to potential null pointer dereferences and memory leaks."

This caused problems with large file support.  Reverting, will examine more closely and attempt a different fix.

This reverts commit 074603293f72400d52c1aaf2d48e3d2d2f49fc21.