From: Zhongxing Xu Date: Tue, 16 Sep 2008 07:58:21 +0000 (+0000) Subject: Fixed an offset calculation error. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3f61c18dd765c27bf900b22dc3a5f2a68e2364a1;p=clang Fixed an offset calculation error. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56242 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Rewrite/RewriteRope.cpp b/lib/Rewrite/RewriteRope.cpp index 0a4dc85968..61cb02b9a5 100644 --- a/lib/Rewrite/RewriteRope.cpp +++ b/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(new char[AllocSize]); AllocBuffer->RefCount = 0; memcpy(AllocBuffer->Data, Start, Len);