File tree 2 files changed +10
-5
lines changed
2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -1935,10 +1935,10 @@ void SSLWrap<Base>::GetCertificate(
1935
1935
1936
1936
Local<Object> result;
1937
1937
1938
- X509Pointer cert ( SSL_get_certificate (w->ssl_ .get () ));
1938
+ X509* cert = SSL_get_certificate (w->ssl_ .get ());
1939
1939
1940
- if (cert)
1941
- result = X509ToObject (env, cert. get () );
1940
+ if (cert != nullptr )
1941
+ result = X509ToObject (env, cert);
1942
1942
1943
1943
args.GetReturnValue ().Set (result);
1944
1944
}
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