test/ssl_test_ctx.c:805: error: NULL_DEREFERENCE
  pointer `ctx` last assigned on line 745 could be null and is dereferenced by call to `SSL_TEST_CTX_free()` at line 805, column 5.
Showing all 50 steps of the trace


test/ssl_test_ctx.c:742:1: start of procedure SSL_TEST_CTX_create()
740.   }
741.   
742. > SSL_TEST_CTX *SSL_TEST_CTX_create(const CONF *conf, const char *test_section)
743.   {
744.       STACK_OF(CONF_VALUE) *sk_conf = NULL;

test/ssl_test_ctx.c:744:5: 
742.   SSL_TEST_CTX *SSL_TEST_CTX_create(const CONF *conf, const char *test_section)
743.   {
744. >     STACK_OF(CONF_VALUE) *sk_conf = NULL;
745.       SSL_TEST_CTX *ctx = NULL;
746.       int i;

test/ssl_test_ctx.c:745:5: 
743.   {
744.       STACK_OF(CONF_VALUE) *sk_conf = NULL;
745. >     SSL_TEST_CTX *ctx = NULL;
746.       int i;
747.       size_t j;

test/ssl_test_ctx.c:749:10: 
747.       size_t j;
748.   
749. >     if (!TEST_ptr(sk_conf = NCONF_get_section(conf, test_section))
750.               || !TEST_ptr(ctx = SSL_TEST_CTX_new()))
751.           goto err;

crypto/conf/conf_lib.c:244:1: start of procedure NCONF_get_section()
  242.   }
  243.   
  244. > STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf, const char *section)
  245.   {
  246.       if (conf == NULL) {

crypto/conf/conf_lib.c:246:9: Taking false branch
  244.   STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf, const char *section)
  245.   {
  246.       if (conf == NULL) {
                 ^
  247.           CONFerr(CONF_F_NCONF_GET_SECTION, CONF_R_NO_CONF);
  248.           return NULL;

crypto/conf/conf_lib.c:251:9: Taking false branch
  249.       }
  250.   
  251.       if (section == NULL) {
                 ^
  252.           CONFerr(CONF_F_NCONF_GET_SECTION, CONF_R_NO_SECTION);
  253.           return NULL;

crypto/conf/conf_lib.c:256:5: 
  254.       }
  255.   
  256. >     return _CONF_get_section_values(conf, section);
  257.   }
  258.   

crypto/conf/conf_api.c:35:1: start of procedure _CONF_get_section_values()
    33.   
    34.   /* Up until OpenSSL 0.9.5a, this was CONF_get_section */
    35. > STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf,
    36.                                                  const char *section)
    37.   {

crypto/conf/conf_api.c:40:5: 
    38.       CONF_VALUE *v;
    39.   
    40. >     v = _CONF_get_section(conf, section);
    41.       if (v != NULL)
    42.           return ((STACK_OF(CONF_VALUE) *)v->value);

crypto/conf/conf_api.c:22:1: start of procedure _CONF_get_section()
      20.   
      21.   /* Up until OpenSSL 0.9.5a, this was get_section */
      22. > CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section)
      23.   {
      24.       CONF_VALUE *v, vv;

crypto/conf/conf_api.c:26:10: Taking false branch
      24.       CONF_VALUE *v, vv;
      25.   
      26.       if ((conf == NULL) || (section == NULL))
                     ^
      27.           return (NULL);
      28.       vv.name = NULL;

crypto/conf/conf_api.c:26:28: Taking false branch
      24.       CONF_VALUE *v, vv;
      25.   
      26.       if ((conf == NULL) || (section == NULL))
                                       ^
      27.           return (NULL);
      28.       vv.name = NULL;

crypto/conf/conf_api.c:28:5: 
      26.       if ((conf == NULL) || (section == NULL))
      27.           return (NULL);
      28. >     vv.name = NULL;
      29.       vv.section = (char *)section;
      30.       v = lh_CONF_VALUE_retrieve(conf->data, &vv);

crypto/conf/conf_api.c:29:5: 
      27.           return (NULL);
      28.       vv.name = NULL;
      29. >     vv.section = (char *)section;
      30.       v = lh_CONF_VALUE_retrieve(conf->data, &vv);
      31.       return (v);

crypto/conf/conf_api.c:30:5: 
      28.       vv.name = NULL;
      29.       vv.section = (char *)section;
      30. >     v = lh_CONF_VALUE_retrieve(conf->data, &vv);
      31.       return (v);
      32.   }

include/openssl/conf.h:32:1: start of procedure lh_CONF_VALUE_retrieve()
        30.   
        31.   DEFINE_STACK_OF(CONF_VALUE)
        32. > DEFINE_LHASH_OF(CONF_VALUE);
        33.   
        34.   struct conf_st;

crypto/lhash/lhash.c:134:1: start of procedure OPENSSL_LH_retrieve()
          132.   }
          133.   
          134. > void *OPENSSL_LH_retrieve(OPENSSL_LHASH *lh, const void *data)
          135.   {
          136.       unsigned long hash;

crypto/lhash/lhash.c:141:5: 
          139.       int scratch;
          140.   
          141. >     lh->error = 0;
          142.       rn = getrn(lh, data, &hash);
          143.   

crypto/lhash/lhash.c:142:5: Skipping getrn(): empty list of specs
          140.   
          141.       lh->error = 0;
          142.       rn = getrn(lh, data, &hash);
                     ^
          143.   
          144.       if (*rn == NULL) {

crypto/lhash/lhash.c:144:9: Taking false branch
          142.       rn = getrn(lh, data, &hash);
          143.   
          144.       if (*rn == NULL) {
                         ^
          145.           CRYPTO_atomic_add(&lh->num_retrieve_miss, 1, &scratch, lh->retrieve_stats_lock);
          146.           return NULL;

crypto/lhash/lhash.c:148:9: 
          146.           return NULL;
          147.       } else {
          148. >         ret = (*rn)->data;
          149.           CRYPTO_atomic_add(&lh->num_retrieve, 1, &scratch, lh->retrieve_stats_lock);
          150.       }

crypto/lhash/lhash.c:149:9: 
          147.       } else {
          148.           ret = (*rn)->data;
          149. >         CRYPTO_atomic_add(&lh->num_retrieve, 1, &scratch, lh->retrieve_stats_lock);
          150.       }
          151.       return ret;

crypto/threads_pthread.c:152:1: start of procedure CRYPTO_atomic_add()
            150.   }
            151.   
            152. > int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock)
            153.   {
            154.   # if defined(__GNUC__) && defined(__ATOMIC_ACQ_REL)

crypto/threads_pthread.c:155:9: Taking false branch
            153.   {
            154.   # if defined(__GNUC__) && defined(__ATOMIC_ACQ_REL)
            155.       if (__atomic_is_lock_free(sizeof(*val), val)) {
                           ^
            156.           *ret = __atomic_add_fetch(val, amount, __ATOMIC_ACQ_REL);
            157.           return 1;

crypto/threads_pthread.c:160:10: 
            158.       }
            159.   # endif
            160. >     if (!CRYPTO_THREAD_write_lock(lock))
            161.           return 0;
            162.   

crypto/threads_pthread.c:64:1: start of procedure CRYPTO_THREAD_write_lock()
              62.   }
              63.   
              64. > int CRYPTO_THREAD_write_lock(CRYPTO_RWLOCK *lock)
              65.   {
              66.   # ifdef USE_RWLOCK

crypto/threads_pthread.c:67:9: Taking true branch
              65.   {
              66.   # ifdef USE_RWLOCK
              67.       if (pthread_rwlock_wrlock(lock) != 0)
                            ^
              68.           return 0;
              69.   # else

crypto/threads_pthread.c:68:9: 
              66.   # ifdef USE_RWLOCK
              67.       if (pthread_rwlock_wrlock(lock) != 0)
              68. >         return 0;
              69.   # else
              70.       if (pthread_mutex_lock(lock) != 0)

crypto/threads_pthread.c:75:1: return from a call to CRYPTO_THREAD_write_lock
              73.   
              74.       return 1;
              75. > }
              76.   
              77.   int CRYPTO_THREAD_unlock(CRYPTO_RWLOCK *lock)

crypto/threads_pthread.c:160:10: Taking true branch
            158.       }
            159.   # endif
            160.       if (!CRYPTO_THREAD_write_lock(lock))
                            ^
            161.           return 0;
            162.   

crypto/threads_pthread.c:161:9: 
            159.   # endif
            160.       if (!CRYPTO_THREAD_write_lock(lock))
            161. >         return 0;
            162.   
            163.       *val += amount;

crypto/threads_pthread.c:170:1: return from a call to CRYPTO_atomic_add
            168.   
            169.       return 1;
            170. > }
            171.   
            172.   # ifdef OPENSSL_SYS_UNIX

crypto/lhash/lhash.c:151:5: 
          149.           CRYPTO_atomic_add(&lh->num_retrieve, 1, &scratch, lh->retrieve_stats_lock);
          150.       }
          151. >     return ret;
          152.   }
          153.   

crypto/lhash/lhash.c:152:1: return from a call to OPENSSL_LH_retrieve
          150.       }
          151.       return ret;
          152. > }
          153.   
          154.   static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg,

include/openssl/conf.h:32:1: return from a call to lh_CONF_VALUE_retrieve
        30.   
        31.   DEFINE_STACK_OF(CONF_VALUE)
        32. > DEFINE_LHASH_OF(CONF_VALUE);
        33.   
        34.   struct conf_st;

crypto/conf/conf_api.c:31:5: 
      29.       vv.section = (char *)section;
      30.       v = lh_CONF_VALUE_retrieve(conf->data, &vv);
      31. >     return (v);
      32.   }
      33.   

crypto/conf/conf_api.c:32:1: return from a call to _CONF_get_section
      30.       v = lh_CONF_VALUE_retrieve(conf->data, &vv);
      31.       return (v);
      32. > }
      33.   
      34.   /* Up until OpenSSL 0.9.5a, this was CONF_get_section */

crypto/conf/conf_api.c:41:9: Taking true branch
    39.   
    40.       v = _CONF_get_section(conf, section);
    41.       if (v != NULL)
                  ^
    42.           return ((STACK_OF(CONF_VALUE) *)v->value);
    43.       else

crypto/conf/conf_api.c:42:9: 
    40.       v = _CONF_get_section(conf, section);
    41.       if (v != NULL)
    42. >         return ((STACK_OF(CONF_VALUE) *)v->value);
    43.       else
    44.           return (NULL);

crypto/conf/conf_api.c:45:1: return from a call to _CONF_get_section_values
    43.       else
    44.           return (NULL);
    45. > }
    46.   
    47.   int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value)

crypto/conf/conf_lib.c:257:1: return from a call to NCONF_get_section
  255.   
  256.       return _CONF_get_section_values(conf, section);
  257. > }
  258.   
  259.   char *NCONF_get_string(const CONF *conf, const char *group, const char *name)

test/testutil/tests.c:227:1: start of procedure test_ptr()
  225.   }
  226.   
  227. > int test_ptr(const char *file, int line, const char *s, const void *p)
  228.   {
  229.       if (p != NULL)

test/testutil/tests.c:229:9: Taking false branch
  227.   int test_ptr(const char *file, int line, const char *s, const void *p)
  228.   {
  229.       if (p != NULL)
                 ^
  230.           return 1;
  231.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);

test/testutil/tests.c:231:5: Skipping test_fail_message(): empty list of specs
  229.       if (p != NULL)
  230.           return 1;
  231.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
             ^
  232.       return 0;
  233.   }

test/testutil/tests.c:232:5: 
  230.           return 1;
  231.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  232. >     return 0;
  233.   }
  234.   

test/testutil/tests.c:233:1: return from a call to test_ptr
  231.       test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);
  232.       return 0;
  233. > }
  234.   
  235.   int test_true(const char *file, int line, const char *s, int b)

test/ssl_test_ctx.c:749:10: Taking true branch
747.       size_t j;
748.   
749.       if (!TEST_ptr(sk_conf = NCONF_get_section(conf, test_section))
                ^
750.               || !TEST_ptr(ctx = SSL_TEST_CTX_new()))
751.           goto err;

test/ssl_test_ctx.c:804:2: 
802.       goto done;
803.   
804. >  err:
805.       SSL_TEST_CTX_free(ctx);
806.       ctx = NULL;

test/ssl_test_ctx.c:805:5: 
803.   
804.    err:
805. >     SSL_TEST_CTX_free(ctx);
806.       ctx = NULL;
807.    done:
