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 @@ -1962,10 +1962,10 @@ void SSLWrap<Base>::GetCertificate(
1962
1962
1963
1963
Local<Object> result;
1964
1964
1965
- X509Pointer cert ( SSL_get_certificate (w->ssl_ .get () ));
1965
+ X509* cert = SSL_get_certificate (w->ssl_ .get ());
1966
1966
1967
- if (cert)
1968
- result = X509ToObject (env, cert. get () );
1967
+ if (cert != nullptr )
1968
+ result = X509ToObject (env, cert);
1969
1969
1970
1970
args.GetReturnValue ().Set (result);
1971
1971
}
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