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


apps/s_server.c:509:1: start of procedure get_ocsp_resp_from_responder()
507.    * them until they were considered "expired".
508.    */
509. > static int get_ocsp_resp_from_responder(SSL *s, tlsextstatusctx *srctx,
510.                                           OCSP_RESPONSE **resp)
511.   {

apps/s_server.c:512:5: 
510.                                           OCSP_RESPONSE **resp)
511.   {
512. >     char *host = NULL, *port = NULL, *path = NULL;
513.       int use_ssl;
514.       STACK_OF(OPENSSL_STRING) *aia = NULL;

apps/s_server.c:514:5: 
512.       char *host = NULL, *port = NULL, *path = NULL;
513.       int use_ssl;
514. >     STACK_OF(OPENSSL_STRING) *aia = NULL;
515.       X509 *x = NULL;
516.       X509_STORE_CTX *inctx = NULL;

apps/s_server.c:515:5: 
513.       int use_ssl;
514.       STACK_OF(OPENSSL_STRING) *aia = NULL;
515. >     X509 *x = NULL;
516.       X509_STORE_CTX *inctx = NULL;
517.       X509_OBJECT *obj;

apps/s_server.c:516:5: 
514.       STACK_OF(OPENSSL_STRING) *aia = NULL;
515.       X509 *x = NULL;
516. >     X509_STORE_CTX *inctx = NULL;
517.       X509_OBJECT *obj;
518.       OCSP_REQUEST *req = NULL;

apps/s_server.c:518:5: 
516.       X509_STORE_CTX *inctx = NULL;
517.       X509_OBJECT *obj;
518. >     OCSP_REQUEST *req = NULL;
519.       OCSP_CERTID *id = NULL;
520.       STACK_OF(X509_EXTENSION) *exts;

apps/s_server.c:519:5: 
517.       X509_OBJECT *obj;
518.       OCSP_REQUEST *req = NULL;
519. >     OCSP_CERTID *id = NULL;
520.       STACK_OF(X509_EXTENSION) *exts;
521.       int ret = SSL_TLSEXT_ERR_NOACK;

apps/s_server.c:521:5: 
519.       OCSP_CERTID *id = NULL;
520.       STACK_OF(X509_EXTENSION) *exts;
521. >     int ret = SSL_TLSEXT_ERR_NOACK;
522.       int i;
523.   

apps/s_server.c:525:5: 
523.   
524.       /* Build up OCSP query from server certificate */
525. >     x = SSL_get_certificate(s);
526.       aia = X509_get1_ocsp(x);
527.       if (aia != NULL) {

ssl/ssl_lib.c:3599:1: start of procedure SSL_get_certificate()
  3597.   }
  3598.   
  3599. > X509 *SSL_get_certificate(const SSL *s)
  3600.   {
  3601.       if (s->cert != NULL)

ssl/ssl_lib.c:3601:9: Taking false branch
  3599.   X509 *SSL_get_certificate(const SSL *s)
  3600.   {
  3601.       if (s->cert != NULL)
                  ^
  3602.           return (s->cert->key->x509);
  3603.       else

ssl/ssl_lib.c:3604:9: 
  3602.           return (s->cert->key->x509);
  3603.       else
  3604. >         return (NULL);
  3605.   }
  3606.   

ssl/ssl_lib.c:3605:1: return from a call to SSL_get_certificate
  3603.       else
  3604.           return (NULL);
  3605. > }
  3606.   
  3607.   EVP_PKEY *SSL_get_privatekey(const SSL *s)

apps/s_server.c:526:5: 
524.       /* Build up OCSP query from server certificate */
525.       x = SSL_get_certificate(s);
526. >     aia = X509_get1_ocsp(x);
527.       if (aia != NULL) {
528.           if (!OCSP_parse_url(sk_OPENSSL_STRING_value(aia, 0),
