diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-10-20 05:25:11 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-10-20 05:25:11 +0000 |
commit | 01fbef61a30abf65be2790811dc7677925c46668 (patch) | |
tree | 0cbd76e1e0a1c8dab7fcd4fc7278e3597c28d696 /lib/Rewrite/RewriteRope.cpp | |
parent | 9cf9f868a5a39099d6a9cf57d5d5693c30486d8d (diff) |
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).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84601 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Rewrite/RewriteRope.cpp')
-rw-r--r-- | lib/Rewrite/RewriteRope.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/Rewrite/RewriteRope.cpp b/lib/Rewrite/RewriteRope.cpp index 30bbcfafb5..bd99732dc8 100644 --- a/lib/Rewrite/RewriteRope.cpp +++ b/lib/Rewrite/RewriteRope.cpp @@ -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); } |