Change *BugReport constructors to take StringRefs.
- Eliminates many calls to std::string.c_str()
- Fixes an invalid read in ReturnStackAddressChecker due to an unsafe call to
StringRef.data() which doesn't guarantee null-termination.
llvm-svn: 88779
diff --git a/clang/lib/Analysis/MallocChecker.cpp b/clang/lib/Analysis/MallocChecker.cpp
index 6655194..6129358 100644
--- a/clang/lib/Analysis/MallocChecker.cpp
+++ b/clang/lib/Analysis/MallocChecker.cpp
@@ -123,7 +123,7 @@
"Try to free a memory block that has been released");
// FIXME: should find where it's freed last time.
BugReport *R = new BugReport(*BT_DoubleFree,
- BT_DoubleFree->getDescription().c_str(), N);
+ BT_DoubleFree->getDescription(), N);
C.EmitReport(R);
}
return;
@@ -152,7 +152,7 @@
"Allocated memory never released. Potential memory leak.");
// FIXME: where it is allocated.
BugReport *R = new BugReport(*BT_Leak,
- BT_Leak->getDescription().c_str(), N);
+ BT_Leak->getDescription(), N);
C.EmitReport(R);
}
}