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

final InputStream IN = httpExchange.getRequestBody();
try(final Scanner scanner = new Scanner(IN,StandardCharsets.UTF_8)){
OUT = scanner.useDelimiter("\\A").next();
IN.close();
}catch(IOException | NoSuchElementException e){
OUT = null;
}

Stream does not close if an exception is thrown (use finally)