JDK-8155211 : Ucrypto Library leaks native memory
  • Type: Bug
  • Component: security-libs
  • Sub-Component: java.security
  • Affected Version: 9
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2016-04-27
  • Updated: 2018-02-08
  • Resolved: 2016-05-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u112Fixed 9 b118Fixed
Related Reports
Relates :  
Description
We observed memory leaks in the ucrypto library when running benchmarks. Millions on small allocations (1byte) allocated in Java_com_oracle_security_ucrypto_NativeCipher_nativeFinal().

Code analysis showed that the output buffer for the cypher operation was not freed under all circumstances. 

Leaks could occur if:
- the output len of the output array was 0 or the output write position is at the end of the output array. In this case, calloc(0) was performed, which yields a valid small allocation, which then is never freed.
- theoretically, if CypherFinal() sets the output length to 0.

This was introduced with JDK-8130875.