Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
external_conscrypt
Commits
1990574e
Commit
1990574e
authored
14 years ago
by
Brian Carlstrom
Browse files
Options
Download
Email Patches
Plain Diff
Scrub missing calls to super.finalize()
Bug: 3024226 Change-Id: I6642cb9d4929ba72244529efe4ebdfa595ae4fa7
parent
bee82fd7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
55 additions
and
41 deletions
+55
-41
luni/src/main/java/org/apache/harmony/xnet/provider/jsse/AbstractSessionContext.java
...he/harmony/xnet/provider/jsse/AbstractSessionContext.java
+6
-2
luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLMessageDigestJDK.java
...e/harmony/xnet/provider/jsse/OpenSSLMessageDigestJDK.java
+7
-5
luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSessionImpl.java
...apache/harmony/xnet/provider/jsse/OpenSSLSessionImpl.java
+6
-2
luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSignature.java
...g/apache/harmony/xnet/provider/jsse/OpenSSLSignature.java
+13
-12
luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSocketImpl.java
.../apache/harmony/xnet/provider/jsse/OpenSSLSocketImpl.java
+23
-20
No files found.
luni/src/main/java/org/apache/harmony/xnet/provider/jsse/AbstractSessionContext.java
View file @
1990574e
...
...
@@ -285,8 +285,12 @@ abstract class AbstractSessionContext implements SSLSessionContext {
"Error converting session."
,
t
);
}
protected
void
finalize
()
throws
IOException
{
NativeCrypto
.
SSL_CTX_free
(
sslCtxNativePointer
);
@Override
protected
void
finalize
()
throws
Throwable
{
try
{
NativeCrypto
.
SSL_CTX_free
(
sslCtxNativePointer
);
}
finally
{
super
.
finalize
();
}
}
/**
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLMessageDigestJDK.java
View file @
1990574e
...
...
@@ -94,11 +94,13 @@ public class OpenSSLMessageDigestJDK extends MessageDigest implements Cloneable
return
d
;
}
@Override
protected
void
finalize
()
throws
Throwable
{
super
.
finalize
();
NativeCrypto
.
EVP_MD_CTX_destroy
(
ctx
);
ctx
=
0
;
@Override
protected
void
finalize
()
throws
Throwable
{
try
{
NativeCrypto
.
EVP_MD_CTX_destroy
(
ctx
);
ctx
=
0
;
}
finally
{
super
.
finalize
();
}
}
public
static
class
MD5
extends
OpenSSLMessageDigestJDK
{
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSessionImpl.java
View file @
1990574e
...
...
@@ -499,7 +499,11 @@ public class OpenSSLSessionImpl implements SSLSession {
}
}
protected
void
finalize
()
{
NativeCrypto
.
SSL_SESSION_free
(
sslSessionNativePointer
);
@Override
protected
void
finalize
()
throws
Throwable
{
try
{
NativeCrypto
.
SSL_SESSION_free
(
sslSessionNativePointer
);
}
finally
{
super
.
finalize
();
}
}
}
This diff is collapsed.
Click to expand it.
luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSignature.java
View file @
1990574e
...
...
@@ -232,20 +232,21 @@ public class OpenSSLSignature extends Signature {
}
@Override
protected
void
finalize
()
throws
Throwable
{
super
.
finalize
();
if
(
dsa
!=
0
)
{
NativeCrypto
.
EVP_PKEY_free
(
dsa
);
}
@Override
protected
void
finalize
()
throws
Throwable
{
try
{
if
(
dsa
!=
0
)
{
NativeCrypto
.
EVP_PKEY_free
(
dsa
);
}
if
(
rsa
!=
0
)
{
NativeCrypto
.
EVP_PKEY_free
(
rsa
);
}
if
(
rsa
!=
0
)
{
NativeCrypto
.
EVP_PKEY_free
(
rsa
);
}
if
(
ctx
!=
0
)
{
NativeCrypto
.
EVP_MD_CTX_destroy
(
ctx
);
if
(
ctx
!=
0
)
{
NativeCrypto
.
EVP_MD_CTX_destroy
(
ctx
);
}
}
finally
{
super
.
finalize
();
}
}
...
...
This diff is collapsed.
Click to expand it.
luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSocketImpl.java
View file @
1990574e
...
...
@@ -1253,25 +1253,28 @@ public class OpenSSLSocketImpl
sslNativePointer
=
0
;
}
@Override
protected
void
finalize
()
throws
IOException
{
/*
* Just worry about our own state. Notably we do not try and
* close anything. The SocketImpl, either our own
* PlainSocketImpl, or the Socket we are wrapping, will do
* that. This might mean we do not properly SSL_shutdown, but
* if you want to do that, properly close the socket yourself.
*
* The reason why we don't try to SSL_shutdown, is that there
* can be a race between finalizers where the PlainSocketImpl
* finalizer runs first and closes the socket. However, in the
* meanwhile, the underlying file descriptor could be reused
* for another purpose. If we call SSL_shutdown, the
* underlying socket BIOs still have the old file descriptor
* and will write the close notify to some unsuspecting
* reader.
*/
updateInstanceCount
(-
1
);
free
();
@Override
protected
void
finalize
()
throws
Throwable
{
try
{
/*
* Just worry about our own state. Notably we do not try and
* close anything. The SocketImpl, either our own
* PlainSocketImpl, or the Socket we are wrapping, will do
* that. This might mean we do not properly SSL_shutdown, but
* if you want to do that, properly close the socket yourself.
*
* The reason why we don't try to SSL_shutdown, is that there
* can be a race between finalizers where the PlainSocketImpl
* finalizer runs first and closes the socket. However, in the
* meanwhile, the underlying file descriptor could be reused
* for another purpose. If we call SSL_shutdown, the
* underlying socket BIOs still have the old file descriptor
* and will write the close notify to some unsuspecting
* reader.
*/
updateInstanceCount
(-
1
);
free
();
}
finally
{
super
.
finalize
();
}
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment