aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/CommentCommandTraits.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/AST/CommentCommandTraits.cpp')
-rw-r--r--lib/AST/CommentCommandTraits.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/AST/CommentCommandTraits.cpp b/lib/AST/CommentCommandTraits.cpp
index 26e2dee3a2..ba0aa9ae12 100644
--- a/lib/AST/CommentCommandTraits.cpp
+++ b/lib/AST/CommentCommandTraits.cpp
@@ -32,9 +32,9 @@ const CommandInfo *CommandTraits::getCommandInfo(unsigned CommandID) const {
}
const CommandInfo *CommandTraits::registerUnknownCommand(StringRef CommandName) {
- char *Name = Allocator.Allocate<char>(CommandName.size());
+ char *Name = Allocator.Allocate<char>(CommandName.size() + 1);
memcpy(Name, CommandName.data(), CommandName.size());
- Name[CommandName.size() + 1] = '\0';
+ Name[CommandName.size()] = '\0';
// Value-initialize (=zero-initialize in this case) a new CommandInfo.
CommandInfo *Info = new (Allocator) CommandInfo();