Corrected a NULL pointer dereference that logic dictates would never happen, but now it is guarded against. clang-based static analysis was used to identify this issue.
Fixed a static-analysis identified issue where malloc was called to allocate 0 bytes.  This may cause a problem on some systems.