summaryrefslogtreecommitdiffstats
path: root/clang/lib/Rewrite
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-10-20 05:25:11 +0000
committerTed Kremenek <kremenek@apple.com>2009-10-20 05:25:11 +0000
commit2f9876cf7c3b616840680e86c0b289b830fa7626 (patch)
tree45144630640a96b4d4a62be91db41734f7132d4e /clang/lib/Rewrite
parentf0b3d15cfed9d3a539a95e226560865769620881 (diff)
downloadbcm5719-llvm-2f9876cf7c3b616840680e86c0b289b830fa7626.tar.gz
bcm5719-llvm-2f9876cf7c3b616840680e86c0b289b830fa7626.zip
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
Diffstat (limited to 'clang/lib/Rewrite')
-rw-r--r--clang/lib/Rewrite/RewriteRope.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/clang/lib/Rewrite/RewriteRope.cpp b/clang/lib/Rewrite/RewriteRope.cpp
index 30bbcfafb53..bd99732dc87 100644
--- a/clang/lib/Rewrite/RewriteRope.cpp
+++ b/clang/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);
}
OpenPOWER on IntegriCloud