summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/MallocChecker.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2009-11-14 12:08:24 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2009-11-14 12:08:24 +0000
commitf4c511b026a8c9d11392c5ce05ff0a6de28d8172 (patch)
tree73f8290ea8de557db9c0c4f5f83c08128af18340 /clang/lib/Analysis/MallocChecker.cpp
parentea956ddf0b664de624b5ca046f5d9daf87ada727 (diff)
downloadbcm5719-llvm-f4c511b026a8c9d11392c5ce05ff0a6de28d8172.tar.gz
bcm5719-llvm-f4c511b026a8c9d11392c5ce05ff0a6de28d8172.zip
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
Diffstat (limited to 'clang/lib/Analysis/MallocChecker.cpp')
-rw-r--r--clang/lib/Analysis/MallocChecker.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Analysis/MallocChecker.cpp b/clang/lib/Analysis/MallocChecker.cpp
index 6655194d5e9..6129358cf73 100644
--- a/clang/lib/Analysis/MallocChecker.cpp
+++ b/clang/lib/Analysis/MallocChecker.cpp
@@ -123,7 +123,7 @@ void MallocChecker::FreeMem(CheckerContext &C, const CallExpr *CE) {
"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 @@ void MallocChecker::EvalDeadSymbols(CheckerContext &C, const Stmt *S,
"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);
}
}
OpenPOWER on IntegriCloud