Fixed memory leaks in error branches. Identified by cppcheck tool.
Added missing newlines to end of file, to fix complier warnings.
Replaced strange cast of 0 with NULL constant.
Fixed file handle leaks in error branches. Identified by cppcheck tool.
Marked private functions as static to fix compiler warnings.
Merge pull request #7 from seanm/develop

Develop branch - warning fixes