[llvm-commits] [dragonegg] r172198 - /dragonegg/trunk/src/Backend.cpp
Duncan Sands
baldrick at free.fr
Fri Jan 11 03:42:59 PST 2013
Author: baldrick
Date: Fri Jan 11 05:42:59 2013
New Revision: 172198
URL: http://llvm.org/viewvc/llvm-project?rev=172198&view=rev
Log:
Avoid use of a dangling pointer by using a copy of the std::string. Pointed out
by Benjamin Kramer.
Modified:
dragonegg/trunk/src/Backend.cpp
Modified: dragonegg/trunk/src/Backend.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/src/Backend.cpp?rev=172198&r1=172197&r2=172198&view=diff
==============================================================================
--- dragonegg/trunk/src/Backend.cpp (original)
+++ dragonegg/trunk/src/Backend.cpp Fri Jan 11 05:42:59 2013
@@ -1795,7 +1795,8 @@
static void InlineAsmDiagnosticHandler(const SMDiagnostic &D, void * /*Data*/,
location_t loc) {
- const char *Message = D.getMessage().str().c_str();
+ std::string S = D.getMessage().str(); // Ensure Message is not dangling.
+ const char *Message = S.c_str();
switch (D.getKind()) {
case SourceMgr::DK_Error:
error_at(loc, "%s", Message);
More information about the llvm-commits
mailing list