Corrected spelling in C source files of test suites.
Fixed possible leak and its Android Lint warning in Java file.
Added a method in Java file which may be overridden for custom messages.