13
0
geforkt von Mirrors/Velocity

Fix memory leak in NativeVelocityCipher

Dieser Commit ist enthalten in:
Andrew Steinborn 2019-06-22 16:03:50 -04:00
Ursprung a3ce20914f
Commit 5a209a098c

Datei anzeigen

@ -56,11 +56,16 @@ public class NativeVelocityCipher implements VelocityCipher {
int len = source.readableBytes();
ByteBuf out = ctx.alloc().directBuffer(len);
impl.process(this.ctx, source.memoryAddress() + source.readerIndex(), len,
out.memoryAddress(), encrypt);
source.skipBytes(len);
out.writerIndex(len);
return out;
try {
impl.process(this.ctx, source.memoryAddress() + source.readerIndex(), len,
out.memoryAddress(), encrypt);
source.skipBytes(len);
out.writerIndex(len);
return out;
} catch (Exception e) {
out.release();
throw e;
}
}
@Override