r192572 - Fix use-after-free in PPCallbacksTest detected by ASan bootstrap bot
Alexey Samsonov
samsonov at google.com
Mon Oct 14 00:14:00 PDT 2013
Author: samsonov
Date: Mon Oct 14 02:13:59 2013
New Revision: 192572
URL: http://llvm.org/viewvc/llvm-project?rev=192572&view=rev
Log:
Fix use-after-free in PPCallbacksTest detected by ASan bootstrap bot
Modified:
cfe/trunk/unittests/Lex/PPCallbacksTest.cpp
Modified: cfe/trunk/unittests/Lex/PPCallbacksTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Lex/PPCallbacksTest.cpp?rev=192572&r1=192571&r2=192572&view=diff
==============================================================================
--- cfe/trunk/unittests/Lex/PPCallbacksTest.cpp (original)
+++ cfe/trunk/unittests/Lex/PPCallbacksTest.cpp Mon Oct 14 02:13:59 2013
@@ -85,7 +85,7 @@ public:
class PragmaOpenCLExtensionCallbacks : public PPCallbacks {
public:
typedef struct {
- StringRef Name;
+ SmallString<16> Name;
unsigned State;
} CallbackParameters;
@@ -95,13 +95,13 @@ public:
clang::SourceLocation NameLoc, const clang::IdentifierInfo *Name,
clang::SourceLocation StateLoc, unsigned State) {
this->NameLoc = NameLoc;
- this->Name = Name->getName().str();
+ this->Name = Name->getName();
this->StateLoc = StateLoc;
this->State = State;
};
SourceLocation NameLoc;
- StringRef Name;
+ SmallString<16> Name;
SourceLocation StateLoc;
unsigned State;
};
@@ -230,7 +230,7 @@ protected:
}
PragmaOpenCLExtensionCallbacks::CallbackParameters RetVal = {
- Callbacks->Name.str(),
+ Callbacks->Name,
Callbacks->State
};
return RetVal;
More information about the cfe-commits
mailing list