summaryrefslogtreecommitdiffstats
path: root/clang/lib/Rewrite/RewriteRope.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Rewrite/RewriteRope.cpp')
-rw-r--r--clang/lib/Rewrite/RewriteRope.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Rewrite/RewriteRope.cpp b/clang/lib/Rewrite/RewriteRope.cpp
index 0a4dc859684..61cb02b9a59 100644
--- a/clang/lib/Rewrite/RewriteRope.cpp
+++ b/clang/lib/Rewrite/RewriteRope.cpp
@@ -792,7 +792,7 @@ RopePiece RewriteRope::MakeRopeString(const char *Start, const char *End) {
if (AllocBuffer && --AllocBuffer->RefCount == 0)
delete [] (char*)AllocBuffer;
- unsigned AllocSize = sizeof(RopeRefCountString)-1+AllocChunkSize;
+ unsigned AllocSize = offsetof(RopeRefCountString, Data) + AllocChunkSize;
AllocBuffer = reinterpret_cast<RopeRefCountString *>(new char[AllocSize]);
AllocBuffer->RefCount = 0;
memcpy(AllocBuffer->Data, Start, Len);
OpenPOWER on IntegriCloud