This is an automated email from the ASF dual-hosted git repository.

bdeggleston pushed a commit to branch cassandra-3.0
in repository https://gitbox.apache.org/repos/asf/cassandra.git


The following commit(s) were added to refs/heads/cassandra-3.0 by this push:
     new cbecd5f  Fix resource leak in CompressedSequentialWriter
cbecd5f is described below

commit cbecd5f2834f233f1c7c912407343cc3a9b517bb
Author: Blake Eggleston <bdeggles...@gmail.com>
AuthorDate: Mon Sep 30 12:53:03 2019 -0700

    Fix resource leak in CompressedSequentialWriter
    
    Patch by Blake Eggleston; Reviewed by Marcus Eriksson for CASSANDRA-15340
---
 CHANGES.txt                                                            | 1 +
 .../org/apache/cassandra/io/compress/CompressedSequentialWriter.java   | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/CHANGES.txt b/CHANGES.txt
index dd7025e..6bf3ee1 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.0.19
+ * Fix resource leak in CompressedSequentialWriter (CASSANDRA-15340)
  * Fix merge which reverted CASSANDRA-14993 (CASSANDRA-15289)
  * Fix LegacyLayout RangeTombstoneList IndexOutOfBoundsException when 
upgrading and RangeTombstone bounds are asymmetric (CASSANDRA-15172)
  * Fix NPE when using allocate_tokens_for_keyspace on new DC/rack 
(CASSANDRA-14952)
diff --git 
a/src/java/org/apache/cassandra/io/compress/CompressedSequentialWriter.java 
b/src/java/org/apache/cassandra/io/compress/CompressedSequentialWriter.java
index 43f1fd0..9c47513 100644
--- a/src/java/org/apache/cassandra/io/compress/CompressedSequentialWriter.java
+++ b/src/java/org/apache/cassandra/io/compress/CompressedSequentialWriter.java
@@ -185,7 +185,10 @@ public class CompressedSequentialWriter extends 
SequentialWriter
         // compressed chunk size (- 4 bytes reserved for checksum)
         int chunkSize = (int) 
(metadataWriter.chunkOffsetBy(realMark.nextChunkIndex) - chunkOffset - 4);
         if (compressed.capacity() < chunkSize)
+        {
+            FileUtils.clean(compressed);
             compressed = compressor.preferredBufferType().allocate(chunkSize);
+        }
 
         try
         {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to