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


apps/s_server.c:477:1: start of procedure get_ocsp_resp_from_responder()
475.    * them until they were considered "expired".
476.    */
477. > static int get_ocsp_resp_from_responder(SSL *s, tlsextstatusctx *srctx,
478.                                           OCSP_RESPONSE **resp)
479.   {

apps/s_server.c:480:5: 
478.                                           OCSP_RESPONSE **resp)
479.   {
480. >     char *host = NULL, *port = NULL, *path = NULL;
481.       int use_ssl;
482.       STACK_OF(OPENSSL_STRING) *aia = NULL;

apps/s_server.c:482:5: 
480.       char *host = NULL, *port = NULL, *path = NULL;
481.       int use_ssl;
482. >     STACK_OF(OPENSSL_STRING) *aia = NULL;
483.       X509 *x = NULL;
484.       X509_STORE_CTX *inctx = NULL;

apps/s_server.c:483:5: 
481.       int use_ssl;
482.       STACK_OF(OPENSSL_STRING) *aia = NULL;
483. >     X509 *x = NULL;
484.       X509_STORE_CTX *inctx = NULL;
485.       X509_OBJECT *obj;

apps/s_server.c:484:5: 
482.       STACK_OF(OPENSSL_STRING) *aia = NULL;
483.       X509 *x = NULL;
484. >     X509_STORE_CTX *inctx = NULL;
485.       X509_OBJECT *obj;
486.       OCSP_REQUEST *req = NULL;

apps/s_server.c:486:5: 
484.       X509_STORE_CTX *inctx = NULL;
485.       X509_OBJECT *obj;
486. >     OCSP_REQUEST *req = NULL;
487.       OCSP_CERTID *id = NULL;
488.       STACK_OF(X509_EXTENSION) *exts;

apps/s_server.c:487:5: 
485.       X509_OBJECT *obj;
486.       OCSP_REQUEST *req = NULL;
487. >     OCSP_CERTID *id = NULL;
488.       STACK_OF(X509_EXTENSION) *exts;
489.       int ret = SSL_TLSEXT_ERR_NOACK;

apps/s_server.c:489:5: 
487.       OCSP_CERTID *id = NULL;
488.       STACK_OF(X509_EXTENSION) *exts;
489. >     int ret = SSL_TLSEXT_ERR_NOACK;
490.       int i;
491.   

apps/s_server.c:493:5: 
491.   
492.       /* Build up OCSP query from server certificate */
493. >     x = SSL_get_certificate(s);
494.       aia = X509_get1_ocsp(x);
495.       if (aia) {

ssl/ssl_lib.c:3504:1: start of procedure SSL_get_certificate()
  3502.   }
  3503.   
  3504. > X509 *SSL_get_certificate(const SSL *s)
  3505.   {
  3506.       if (s->cert != NULL)

ssl/ssl_lib.c:3506:9: Taking false branch
  3504.   X509 *SSL_get_certificate(const SSL *s)
  3505.   {
  3506.       if (s->cert != NULL)
                  ^
  3507.           return (s->cert->key->x509);
  3508.       else

ssl/ssl_lib.c:3509:9: 
  3507.           return (s->cert->key->x509);
  3508.       else
  3509. >         return (NULL);
  3510.   }
  3511.   

ssl/ssl_lib.c:3510:1: return from a call to SSL_get_certificate
  3508.       else
  3509.           return (NULL);
  3510. > }
  3511.   
  3512.   EVP_PKEY *SSL_get_privatekey(const SSL *s)

apps/s_server.c:494:5: 
492.       /* Build up OCSP query from server certificate */
493.       x = SSL_get_certificate(s);
494. >     aia = X509_get1_ocsp(x);
495.       if (aia) {
496.           if (!OCSP_parse_url(sk_OPENSSL_STRING_value(aia, 0),
