aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/helper
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/helper')
-rw-r--r--src/org/traccar/helper/BufferUtil.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/org/traccar/helper/BufferUtil.java b/src/org/traccar/helper/BufferUtil.java
index 81a081182..5606dba8a 100644
--- a/src/org/traccar/helper/BufferUtil.java
+++ b/src/org/traccar/helper/BufferUtil.java
@@ -28,8 +28,12 @@ public final class BufferUtil {
}
public static int indexOf(String needle, ByteBuf haystack) {
- return ByteBufUtil.indexOf(
- Unpooled.wrappedBuffer(needle.getBytes(StandardCharsets.US_ASCII)), haystack);
+ ByteBuf needleBuffer = Unpooled.wrappedBuffer(needle.getBytes(StandardCharsets.US_ASCII));
+ try {
+ return ByteBufUtil.indexOf(needleBuffer, haystack);
+ } finally {
+ needleBuffer.release();
+ }
}
public static int indexOf(String needle, ByteBuf haystack, int startIndex, int endIndex) {