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

pvillard pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git


The following commit(s) were added to refs/heads/main by this push:
     new b4cdd043060 NIFI-15690 Fixed ByteBuf leak in CacheRequestDecoder 
readHeader (#10988)
b4cdd043060 is described below

commit b4cdd043060f6aef690fa284a2f0529fdfb08090
Author: Dan Chaffelson <[email protected]>
AuthorDate: Tue Mar 10 08:58:29 2026 +0000

    NIFI-15690 Fixed ByteBuf leak in CacheRequestDecoder readHeader (#10988)
    
    Replaced readBytes(HEADER_LENGTH) with skipBytes(HEADER_LENGTH) to avoid
    allocating a ByteBuf that is never released. The header bytes are discarded
    so skipBytes achieves the same result without allocation.
---
 .../apache/nifi/distributed/cache/server/codec/CacheRequestDecoder.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/nifi-extension-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-server/src/main/java/org/apache/nifi/distributed/cache/server/codec/CacheRequestDecoder.java
 
b/nifi-extension-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-server/src/main/java/org/apache/nifi/distributed/cache/server/codec/CacheRequestDecoder.java
index 627f4c8c0b0..93a86ed5c9c 100644
--- 
a/nifi-extension-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-server/src/main/java/org/apache/nifi/distributed/cache/server/codec/CacheRequestDecoder.java
+++ 
b/nifi-extension-bundles/nifi-standard-services/nifi-distributed-cache-services-bundle/nifi-distributed-cache-server/src/main/java/org/apache/nifi/distributed/cache/server/codec/CacheRequestDecoder.java
@@ -235,7 +235,7 @@ public class CacheRequestDecoder extends 
ByteToMessageDecoder {
 
     private void readHeader(final ByteBuf byteBuf, final SocketAddress 
remoteAddress) {
         if (byteBuf.readableBytes() >= HEADER_LENGTH) {
-            byteBuf.readBytes(HEADER_LENGTH);
+            byteBuf.skipBytes(HEADER_LENGTH);
             headerReceived.getAndSet(true);
             log.debug("Header Received [{}]", remoteAddress);
         }

Reply via email to