Fixed clang-reported error: calling strlen on null pointer.
Fixed clang-reported issue: memory leak.
Fixed clang-reported issue: memory leak.