mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8268525: Some new memory leak after JDK-8248268 and JDK-8255557
Reviewed-by: valeriep, ascarpino
This commit is contained in:
parent
53b6e2c85c
commit
7b2e7d8bab
5 changed files with 91 additions and 108 deletions
|
@ -472,7 +472,11 @@ abstract class KeyWrapCipher extends CipherSpi {
|
|||
int outLen = engineDoFinal(in, inOfs, inLen, out, 0);
|
||||
|
||||
if (outLen < estOutLen) {
|
||||
return Arrays.copyOf(out, outLen);
|
||||
try {
|
||||
return Arrays.copyOf(out, outLen);
|
||||
} finally {
|
||||
Arrays.fill(out, (byte)0);
|
||||
}
|
||||
} else {
|
||||
return out;
|
||||
}
|
||||
|
@ -529,6 +533,9 @@ abstract class KeyWrapCipher extends CipherSpi {
|
|||
return outLen;
|
||||
}
|
||||
} finally {
|
||||
if (dataBuf != null) {
|
||||
Arrays.fill(dataBuf, (byte)0);
|
||||
}
|
||||
dataBuf = null;
|
||||
dataIdx = 0;
|
||||
}
|
||||
|
@ -559,8 +566,14 @@ abstract class KeyWrapCipher extends CipherSpi {
|
|||
len += inLen;
|
||||
}
|
||||
|
||||
return (opmode == Cipher.ENCRYPT_MODE?
|
||||
helperEncrypt(out, len) : helperDecrypt(out, len));
|
||||
try {
|
||||
return (opmode == Cipher.ENCRYPT_MODE ?
|
||||
helperEncrypt(out, len) : helperDecrypt(out, len));
|
||||
} finally {
|
||||
if (dataBuf != null && dataBuf != out) {
|
||||
Arrays.fill(dataBuf, (byte)0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// helper routine for in-place encryption.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue