Fix memory leaks in ProtobufDecoder

Issue: SPR-17418
This commit is contained in:
Arjen Poutsma
2018-10-22 13:39:22 +02:00
parent a64e85fcc6
commit 946ec7e22e
3 changed files with 32 additions and 29 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -66,9 +66,12 @@ public abstract class AbstractDataBufferAllocatingTestCase {
}
protected DataBuffer stringBuffer(String value) {
byte[] bytes = value.getBytes(StandardCharsets.UTF_8);
DataBuffer buffer = this.bufferFactory.allocateBuffer(bytes.length);
buffer.write(bytes);
return byteBuffer(value.getBytes(StandardCharsets.UTF_8));
}
protected DataBuffer byteBuffer(byte[] value) {
DataBuffer buffer = this.bufferFactory.allocateBuffer(value.length);
buffer.write(value);
return buffer;
}