diff options
Diffstat (limited to 'lib/Rewrite/RewriteRope.cpp')
-rw-r--r-- | lib/Rewrite/RewriteRope.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Rewrite/RewriteRope.cpp b/lib/Rewrite/RewriteRope.cpp index bd99732dc8..30bbcfafb5 100644 --- a/lib/Rewrite/RewriteRope.cpp +++ b/lib/Rewrite/RewriteRope.cpp @@ -798,8 +798,9 @@ RopePiece RewriteRope::MakeRopeString(const char *Start, const char *End) { memcpy(AllocBuffer->Data, Start, Len); AllocOffs = Len; - // Return a RopePiece that wraps 'AllocBuffer'. The constructor of RopePiece - // will increment the reference count of AllocBuffer. + // Start out the new allocation with a refcount of 1, since we have an + // internal reference to it. + AllocBuffer->addRef(); return RopePiece(AllocBuffer, 0, Len); } |