test/sslapitest.c:703: error: NULL_DEREFERENCE
  pointer `sctx` last assigned on line 638 could be null and is dereferenced by call to `SSL_CTX_free()` at line 703, column 5.
Showing all 37 steps of the trace


test/sslapitest.c:633:1: start of procedure execute_test_large_message()
631.   #endif
632.   
633. > static int execute_test_large_message(const SSL_METHOD *smeth,
634.                                         const SSL_METHOD *cmeth,
635.                                         int min_version, int max_version,

test/sslapitest.c:638:5: 
636.                                         int read_ahead)
637.   {
638. >     SSL_CTX *cctx = NULL, *sctx = NULL;
639.       SSL *clientssl = NULL, *serverssl = NULL;
640.       int testresult = 0;

test/sslapitest.c:639:5: 
637.   {
638.       SSL_CTX *cctx = NULL, *sctx = NULL;
639. >     SSL *clientssl = NULL, *serverssl = NULL;
640.       int testresult = 0;
641.       int i;

test/sslapitest.c:640:5: 
638.       SSL_CTX *cctx = NULL, *sctx = NULL;
639.       SSL *clientssl = NULL, *serverssl = NULL;
640. >     int testresult = 0;
641.       int i;
642.       BIO *certbio = NULL;

test/sslapitest.c:642:5: 
640.       int testresult = 0;
641.       int i;
642. >     BIO *certbio = NULL;
643.       X509 *chaincert = NULL;
644.       int certlen;

test/sslapitest.c:643:5: 
641.       int i;
642.       BIO *certbio = NULL;
643. >     X509 *chaincert = NULL;
644.       int certlen;
645.   

test/sslapitest.c:646:10: Skipping BIO_new_file(): empty list of specs
644.       int certlen;
645.   
646.       if (!TEST_ptr(certbio = BIO_new_file(cert, "r")))
                ^
647.           goto end;
648.       chaincert = PEM_read_bio_X509(certbio, NULL, NULL, NULL);

test/testutil/tests.c:252:1: start of procedure test_ptr()
  250.   }
  251.   
  252. > int test_ptr(const char *file, int line, const char *s, const void *p)
  253.   {
  254.       if (p != NULL)

test/testutil/tests.c:254:9: Taking false branch
  252.   int test_ptr(const char *file, int line, const char *s, const void *p)
  253.   {
  254.       if (p != NULL)
                 ^
  255.           return 1;
  256.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);

test/testutil/tests.c:256:5: Skipping test_fail_message(): empty list of specs
  254.       if (p != NULL)
  255.           return 1;
  256.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
             ^
  257.       return 0;
  258.   }

test/testutil/tests.c:257:5: 
  255.           return 1;
  256.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  257. >     return 0;
  258.   }
  259.   

test/testutil/tests.c:258:1: return from a call to test_ptr
  256.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  257.       return 0;
  258. > }
  259.   
  260.   int test_true(const char *file, int line, const char *s, int b)

test/sslapitest.c:646:10: Taking true branch
644.       int certlen;
645.   
646.       if (!TEST_ptr(certbio = BIO_new_file(cert, "r")))
                ^
647.           goto end;
648.       chaincert = PEM_read_bio_X509(certbio, NULL, NULL, NULL);

test/sslapitest.c:699:2: 
697.   
698.       testresult = 1;
699. >  end:
700.       X509_free(chaincert);
701.       SSL_free(serverssl);

test/sslapitest.c:700:5: 
698.       testresult = 1;
699.    end:
700. >     X509_free(chaincert);
701.       SSL_free(serverssl);
702.       SSL_free(clientssl);

crypto/x509/x_x509.c:118:1: start of procedure X509_free()
  116.   } ASN1_SEQUENCE_END_ref(X509, X509)
  117.   
  118. > IMPLEMENT_ASN1_FUNCTIONS(X509)
  119.   IMPLEMENT_ASN1_DUP_FUNCTION(X509)
  120.   

crypto/x509/x_x509.c:116:3: start of procedure X509_it()
    114.           ASN1_EMBED(X509, sig_alg, X509_ALGOR),
    115.           ASN1_EMBED(X509, signature, ASN1_BIT_STRING)
    116.   } ASN1_SEQUENCE_END_ref(X509, X509)
             ^
    117.   
    118.   IMPLEMENT_ASN1_FUNCTIONS(X509)

crypto/x509/x_x509.c:116:3: return from a call to X509_it
    114.           ASN1_EMBED(X509, sig_alg, X509_ALGOR),
    115.           ASN1_EMBED(X509, signature, ASN1_BIT_STRING)
    116.   } ASN1_SEQUENCE_END_ref(X509, X509)
             ^
    117.   
    118.   IMPLEMENT_ASN1_FUNCTIONS(X509)

crypto/asn1/tasn_fre.c:18:1: start of procedure ASN1_item_free()
    16.   /* Free up an ASN1 structure */
    17.   
    18. > void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it)
    19.   {
    20.       asn1_item_embed_free(&val, it, 0);

crypto/asn1/tasn_fre.c:20:5: Skipping asn1_item_embed_free(): empty list of specs
    18.   void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it)
    19.   {
    20.       asn1_item_embed_free(&val, it, 0);
              ^
    21.   }
    22.   

crypto/asn1/tasn_fre.c:21:1: return from a call to ASN1_item_free
    19.   {
    20.       asn1_item_embed_free(&val, it, 0);
    21. > }
    22.   
    23.   void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it)

crypto/x509/x_x509.c:118:1: return from a call to X509_free
  116.   } ASN1_SEQUENCE_END_ref(X509, X509)
  117.   
  118. > IMPLEMENT_ASN1_FUNCTIONS(X509)
  119.   IMPLEMENT_ASN1_DUP_FUNCTION(X509)
  120.   

test/sslapitest.c:701:5: Skipping SSL_free(): empty list of specs
699.    end:
700.       X509_free(chaincert);
701.       SSL_free(serverssl);
           ^
702.       SSL_free(clientssl);
703.       SSL_CTX_free(sctx);

test/sslapitest.c:702:5: Skipping SSL_free(): empty list of specs
700.       X509_free(chaincert);
701.       SSL_free(serverssl);
702.       SSL_free(clientssl);
           ^
703.       SSL_CTX_free(sctx);
704.       SSL_CTX_free(cctx);

test/sslapitest.c:703:5: 
701.       SSL_free(serverssl);
702.       SSL_free(clientssl);
703. >     SSL_CTX_free(sctx);
704.       SSL_CTX_free(cctx);
705.   

ssl/ssl_lib.c:3239:1: start of procedure SSL_CTX_free()
  3237.   }
  3238.   
  3239. > void SSL_CTX_free(SSL_CTX *a)
  3240.   {
  3241.       int i;

ssl/ssl_lib.c:3243:9: Taking false branch
  3241.       int i;
  3242.   
  3243.       if (a == NULL)
                  ^
  3244.           return;
  3245.   

ssl/ssl_lib.c:3246:5: 
  3244.           return;
  3245.   
  3246. >     CRYPTO_DOWN_REF(&a->references, &i, a->lock);
  3247.       REF_PRINT_COUNT("SSL_CTX", a);
  3248.       if (i > 0)

include/internal/refcount.h:49:1: start of procedure CRYPTO_DOWN_REF()
    47.    * otherwise imply an acquire fence. Hence conditional acquire fence...
    48.    */
    49. > static inline int CRYPTO_DOWN_REF(_Atomic int *val, int *ret, void *lock)
    50.   {
    51.       *ret = atomic_fetch_sub_explicit(val, 1, memory_order_relaxed) - 1;

include/internal/refcount.h:51:5: 
    49.   static inline int CRYPTO_DOWN_REF(_Atomic int *val, int *ret, void *lock)
    50.   {
    51. >     *ret = atomic_fetch_sub_explicit(val, 1, memory_order_relaxed) - 1;
    52.       if (*ret == 0)
    53.           atomic_thread_fence(memory_order_acquire);

include/internal/refcount.h:52:9: Taking true branch
    50.   {
    51.       *ret = atomic_fetch_sub_explicit(val, 1, memory_order_relaxed) - 1;
    52.       if (*ret == 0)
                  ^
    53.           atomic_thread_fence(memory_order_acquire);
    54.       return 1;

include/internal/refcount.h:53:9: Skipping __c11_atomic_thread_fence(): method has no implementation
    51.       *ret = atomic_fetch_sub_explicit(val, 1, memory_order_relaxed) - 1;
    52.       if (*ret == 0)
    53.           atomic_thread_fence(memory_order_acquire);
                  ^
    54.       return 1;
    55.   }

include/internal/refcount.h:54:5: 
    52.       if (*ret == 0)
    53.           atomic_thread_fence(memory_order_acquire);
    54. >     return 1;
    55.   }
    56.   

include/internal/refcount.h:55:1: return from a call to CRYPTO_DOWN_REF
    53.           atomic_thread_fence(memory_order_acquire);
    54.       return 1;
    55. > }
    56.   
    57.   #  elif defined(__GNUC__) && defined(__ATOMIC_RELAXED) && __GCC_ATOMIC_INT_LOCK_FREE > 0

ssl/ssl_lib.c:3248:9: Taking true branch
  3246.       CRYPTO_DOWN_REF(&a->references, &i, a->lock);
  3247.       REF_PRINT_COUNT("SSL_CTX", a);
  3248.       if (i > 0)
                  ^
  3249.           return;
  3250.       REF_ASSERT_ISNT(i < 0);

ssl/ssl_lib.c:3249:9: 
  3247.       REF_PRINT_COUNT("SSL_CTX", a);
  3248.       if (i > 0)
  3249. >         return;
  3250.       REF_ASSERT_ISNT(i < 0);
  3251.   

ssl/ssl_lib.c:3301:1: return from a call to SSL_CTX_free
  3299.   
  3300.       OPENSSL_free(a);
  3301. > }
  3302.   
  3303.   void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb)
