Prevent memory leak at getPeerCertificate when only the top certificate is requested