mirror of https://github.com/hykilpikonna/AquaDX
[F] Fix memory leak
parent
c99d8e7e75
commit
64ba0db228
|
@ -3,7 +3,6 @@ package icu.samnyan.aqua.sega.aimedb
|
||||||
import io.netty.buffer.ByteBuf
|
import io.netty.buffer.ByteBuf
|
||||||
import io.netty.channel.ChannelHandlerContext
|
import io.netty.channel.ChannelHandlerContext
|
||||||
import io.netty.handler.codec.ByteToMessageDecoder
|
import io.netty.handler.codec.ByteToMessageDecoder
|
||||||
import org.slf4j.Logger
|
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,7 +10,7 @@ import org.slf4j.LoggerFactory
|
||||||
*/
|
*/
|
||||||
class AimeDbDecoder : ByteToMessageDecoder() {
|
class AimeDbDecoder : ByteToMessageDecoder() {
|
||||||
companion object {
|
companion object {
|
||||||
val logger: Logger = LoggerFactory.getLogger(AimeDbDecoder::class.java)
|
val logger = LoggerFactory.getLogger(AimeDbDecoder::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
var length = 0
|
var length = 0
|
||||||
|
@ -28,11 +27,14 @@ class AimeDbDecoder : ByteToMessageDecoder() {
|
||||||
if (length < 0 || input.readableBytes() < length) return
|
if (length < 0 || input.readableBytes() < length) return
|
||||||
|
|
||||||
// Create a byte array to store the encrypted data
|
// Create a byte array to store the encrypted data
|
||||||
val result = AimeDbEncryption.decrypt(input.readBytes(length))
|
val d = input.readBytes(length)
|
||||||
|
val result = AimeDbEncryption.decrypt(d)
|
||||||
|
d.release()
|
||||||
|
|
||||||
val resultMap: MutableMap<String, Any> = HashMap()
|
val resultMap = mapOf(
|
||||||
resultMap["type"] = result.getShortLE(0x04).toInt()
|
"type" to result.getShortLE(0x04).toInt(),
|
||||||
resultMap["data"] = result
|
"data" to result
|
||||||
|
)
|
||||||
|
|
||||||
logger.debug("AimeDB Request Type: " + resultMap["type"])
|
logger.debug("AimeDB Request Type: " + resultMap["type"])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue