This repository was archived by the owner on Mar 4, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -1980,10 +1980,10 @@ void SSLWrap<Base>::GetCertificate(
1980
1980
1981
1981
Local<Object> result;
1982
1982
1983
- X509Pointer cert ( SSL_get_certificate (w->ssl_ .get () ));
1983
+ X509* cert = SSL_get_certificate (w->ssl_ .get ());
1984
1984
1985
- if (cert)
1986
- result = X509ToObject (env, cert. get () );
1985
+ if (cert != nullptr )
1986
+ result = X509ToObject (env, cert);
1987
1987
1988
1988
args.GetReturnValue ().Set (result);
1989
1989
}
Original file line number Diff line number Diff line change @@ -37,8 +37,13 @@ const server = tls
37
37
rejectUnauthorized : false
38
38
} ,
39
39
function ( ) {
40
- assert . strictEqual ( client . getCertificate ( ) . serialNumber ,
41
- 'ECC9B856270DA9A8' ) ;
40
+ for ( let i = 0 ; i < 10 ; ++ i ) {
41
+ // Calling this repeatedly is a regression test that verifies
42
+ // that .getCertificate() does not accidentally decrease the
43
+ // reference count of the X509* certificate on the native side.
44
+ assert . strictEqual ( client . getCertificate ( ) . serialNumber ,
45
+ 'ECC9B856270DA9A8' ) ;
46
+ }
42
47
client . end ( ) ;
43
48
server . close ( ) ;
44
49
}
You can’t perform that action at this time.
0 commit comments