Ktt-Development/simplehttpserver

Potential memory leak

Katsute opened this issue · 0 comments

Prerequisites

If all checks are not passed then the issue will be closed

  • I have checked that no other similar issue already exists

Operating System: Operating system name and version
Windows 10

Release Version: Release version or branch where the issue occurred
v02.00.00+

Issue

Explain your issue. Add any screenshots here

@Override
public void send(final byte[] response, final int responseCode, final boolean gzip) throws IOException{
if(gzip){
exchange.getResponseHeaders().set("Accept-Encoding","gzip");
exchange.getResponseHeaders().set("Content-Encoding","gzip");
exchange.getResponseHeaders().set("Connection","keep-alive");
sendResponseHeaders(responseCode, 0);
GZIPOutputStream OUT = new GZIPOutputStream(exchange.getResponseBody());
OUT.write(response);
OUT.finish();
}else{
sendResponseHeaders(responseCode,response.length);
final OutputStream OUT = exchange.getResponseBody();
OUT.write(response);
OUT.flush();
}
}

Stream is not closed.