replace malloc/free with new/delete
refactoring objString