apps/s_server.c:519: error: NULL_DEREFERENCE
  pointer `x` last assigned on line 518 could be null and is dereferenced by call to `X509_get1_ocsp()` at line 519, column 11.
Showing all 14 steps of the trace


apps/s_server.c:502:1: start of procedure get_ocsp_resp_from_responder()
500.    * them until they were considered "expired".
501.    */
502. > static int get_ocsp_resp_from_responder(SSL *s, tlsextstatusctx *srctx,
503.                                           OCSP_RESPONSE **resp)
504.   {

apps/s_server.c:505:5: 
503.                                           OCSP_RESPONSE **resp)
504.   {
505. >     char *host = NULL, *port = NULL, *path = NULL;
506.       int use_ssl;
507.       STACK_OF(OPENSSL_STRING) *aia = NULL;

apps/s_server.c:507:5: 
505.       char *host = NULL, *port = NULL, *path = NULL;
506.       int use_ssl;
507. >     STACK_OF(OPENSSL_STRING) *aia = NULL;
508.       X509 *x = NULL;
509.       X509_STORE_CTX *inctx = NULL;

apps/s_server.c:508:5: 
506.       int use_ssl;
507.       STACK_OF(OPENSSL_STRING) *aia = NULL;
508. >     X509 *x = NULL;
509.       X509_STORE_CTX *inctx = NULL;
510.       X509_OBJECT *obj;

apps/s_server.c:509:5: 
507.       STACK_OF(OPENSSL_STRING) *aia = NULL;
508.       X509 *x = NULL;
509. >     X509_STORE_CTX *inctx = NULL;
510.       X509_OBJECT *obj;
511.       OCSP_REQUEST *req = NULL;

apps/s_server.c:511:5: 
509.       X509_STORE_CTX *inctx = NULL;
510.       X509_OBJECT *obj;
511. >     OCSP_REQUEST *req = NULL;
512.       OCSP_CERTID *id = NULL;
513.       STACK_OF(X509_EXTENSION) *exts;

apps/s_server.c:512:5: 
510.       X509_OBJECT *obj;
511.       OCSP_REQUEST *req = NULL;
512. >     OCSP_CERTID *id = NULL;
513.       STACK_OF(X509_EXTENSION) *exts;
514.       int ret = SSL_TLSEXT_ERR_NOACK;

apps/s_server.c:514:5: 
512.       OCSP_CERTID *id = NULL;
513.       STACK_OF(X509_EXTENSION) *exts;
514. >     int ret = SSL_TLSEXT_ERR_NOACK;
515.       int i;
516.   

apps/s_server.c:518:5: 
516.   
517.       /* Build up OCSP query from server certificate */
518. >     x = SSL_get_certificate(s);
519.       aia = X509_get1_ocsp(x);
520.       if (aia != NULL) {

ssl/ssl_lib.c:3444:1: start of procedure SSL_get_certificate()
  3442.   }
  3443.   
  3444. > X509 *SSL_get_certificate(const SSL *s)
  3445.   {
  3446.       if (s->cert != NULL)

ssl/ssl_lib.c:3446:9: Taking false branch
  3444.   X509 *SSL_get_certificate(const SSL *s)
  3445.   {
  3446.       if (s->cert != NULL)
                  ^
  3447.           return (s->cert->key->x509);
  3448.       else

ssl/ssl_lib.c:3449:9: 
  3447.           return (s->cert->key->x509);
  3448.       else
  3449. >         return (NULL);
  3450.   }
  3451.   

ssl/ssl_lib.c:3450:1: return from a call to SSL_get_certificate
  3448.       else
  3449.           return (NULL);
  3450. > }
  3451.   
  3452.   EVP_PKEY *SSL_get_privatekey(const SSL *s)

apps/s_server.c:519:5: 
517.       /* Build up OCSP query from server certificate */
518.       x = SSL_get_certificate(s);
519. >     aia = X509_get1_ocsp(x);
520.       if (aia != NULL) {
521.           if (!OCSP_parse_url(sk_OPENSSL_STRING_value(aia, 0),
