Fixed an offset calculation error.

llvm-svn: 56242
This commit is contained in:
Zhongxing Xu 2008-09-16 07:58:21 +00:00
parent 3f41b87e8d
commit 5912c6e6f0
1 changed files with 1 additions and 1 deletions

View File

@ -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);