GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Codec-compression: Improve LZF allocation cleanup · netty/netty@5a18a30

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • codec-compression/src/main/java/io/netty/handler/codec/compression
    • LzfDecompressor.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎codec-compression/src/main/java/io/netty/handler/codec/compression/LzfDecompressor.java‎

Copy file name to clipboardExpand all lines: codec-compression/src/main/java/io/netty/handler/codec/compression/LzfDecompressor.java
+9-9Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
* and <a href="https://github.com/ning/compress/wiki/LZFFormat">LZF format</a> for full description.
3737
*/
3838
@UnstableApi
39-
public class LzfDecompressor extends InputBufferingDecompressor {
39+
public final class LzfDecompressor extends InputBufferingDecompressor {
4040
/**
4141
* Current state of decompression.
4242
*/
@@ -188,24 +188,24 @@ ByteBuf processOutput(ByteBuf in) throws DecompressionException {
188188
final byte[] inputArray = arrayView.array();
189189
final int inPos = arrayView.arrayOffset() + arrayView.readerIndex();
190190

191-
ByteBuf uncompressed = allocator.heapBuffer(originalLength, originalLength);
192-
final byte[] outputArray = uncompressed.array();
193-
final int outPos = uncompressed.arrayOffset() + uncompressed.writerIndex();
194-
195-
boolean success = false;
191+
ByteBuf uncompressed = null;
196192
try {
193+
uncompressed = allocator.heapBuffer(originalLength, originalLength);
194+
final byte[] outputArray = uncompressed.array();
195+
final int outPos = uncompressed.arrayOffset() + uncompressed.writerIndex();
197196
decoder.decodeChunk(
198197
inputArray, inPos, inPos + chunkLength,
199198
outputArray, outPos, outPos + originalLength);
200199
uncompressed.writerIndex(uncompressed.writerIndex() + originalLength);
201200
in.skipBytes(chunkLength);
202201
currentState = State.INIT_BLOCK;
203-
success = true;
204-
return uncompressed;
202+
ByteBuf output = uncompressed;
203+
uncompressed = null;
204+
return output;
205205
} catch (LZFException e) {
206206
throw new DecompressionException(e);
207207
} finally {
208-
if (!success) {
208+
if (uncompressed != null) {
209209
uncompressed.release();
210210
}
211211
if (arrayView != in) {

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.