Fix a reference count imbalance in RewriteRope::MakeRopeString().

This was causing a ton of memory to be leaked when using HTML
diagnostics with the static analyzer (on large files with many errors).

llvm-svn: 84601
This commit is contained in:
Ted Kremenek 2009-10-20 05:25:11 +00:00
parent f0b3d15cfe
commit 2f9876cf7c
1 changed files with 2 additions and 3 deletions

View File

@ -798,9 +798,8 @@ RopePiece RewriteRope::MakeRopeString(const char *Start, const char *End) {
memcpy(AllocBuffer->Data, Start, Len);
AllocOffs = Len;
// Start out the new allocation with a refcount of 1, since we have an
// internal reference to it.
AllocBuffer->addRef();
// Return a RopePiece that wraps 'AllocBuffer'. The constructor of RopePiece
// will increment the reference count of AllocBuffer.
return RopePiece(AllocBuffer, 0, Len);
}