test/danetest.c:126: error: MEMORY_LEAK
  memory dynamically allocated to `return` by call to `X509_STORE_CTX_new()` at line 122, column 22 is not reachable after line 126, column 2.
Showing all 41 steps of the trace


test/danetest.c:113:1: start of procedure verify_chain()
111.   }
112.   
113. > static int verify_chain(SSL *ssl, STACK_OF(X509) *chain)
114.   {
115.       int ret;

test/danetest.c:117:5: 
115.       int ret;
116.       X509_STORE_CTX *store_ctx;
117. >     SSL_CTX *ssl_ctx = SSL_get_SSL_CTX(ssl);
118.       X509_STORE *store = SSL_CTX_get_cert_store(ssl_ctx);
119.       int store_ctx_idx = SSL_get_ex_data_X509_STORE_CTX_idx();

ssl/ssl_lib.c:3287:1: start of procedure SSL_get_SSL_CTX()
  3285.   }
  3286.   
  3287. > SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl)
  3288.   {
  3289.       return (ssl->ctx);

ssl/ssl_lib.c:3289:5: 
  3287.   SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl)
  3288.   {
  3289. >     return (ssl->ctx);
  3290.   }
  3291.   

ssl/ssl_lib.c:3290:1: return from a call to SSL_get_SSL_CTX
  3288.   {
  3289.       return (ssl->ctx);
  3290. > }
  3291.   
  3292.   SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx)

test/danetest.c:118:5: 
116.       X509_STORE_CTX *store_ctx;
117.       SSL_CTX *ssl_ctx = SSL_get_SSL_CTX(ssl);
118. >     X509_STORE *store = SSL_CTX_get_cert_store(ssl_ctx);
119.       int store_ctx_idx = SSL_get_ex_data_X509_STORE_CTX_idx();
120.       X509 *cert = sk_X509_value(chain, 0);

ssl/ssl_lib.c:3460:1: start of procedure SSL_CTX_get_cert_store()
  3458.   }
  3459.   
  3460. > X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *ctx)
  3461.   {
  3462.       return (ctx->cert_store);

ssl/ssl_lib.c:3462:5: 
  3460.   X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *ctx)
  3461.   {
  3462. >     return (ctx->cert_store);
  3463.   }
  3464.   

ssl/ssl_lib.c:3463:1: return from a call to SSL_CTX_get_cert_store
  3461.   {
  3462.       return (ctx->cert_store);
  3463. > }
  3464.   
  3465.   void SSL_CTX_set_cert_store(SSL_CTX *ctx, X509_STORE *store)

test/danetest.c:119:5: Skipping SSL_get_ex_data_X509_STORE_CTX_idx(): empty list of specs
117.       SSL_CTX *ssl_ctx = SSL_get_SSL_CTX(ssl);
118.       X509_STORE *store = SSL_CTX_get_cert_store(ssl_ctx);
119.       int store_ctx_idx = SSL_get_ex_data_X509_STORE_CTX_idx();
           ^
120.       X509 *cert = sk_X509_value(chain, 0);
121.   

test/danetest.c:120:5: 
118.       X509_STORE *store = SSL_CTX_get_cert_store(ssl_ctx);
119.       int store_ctx_idx = SSL_get_ex_data_X509_STORE_CTX_idx();
120. >     X509 *cert = sk_X509_value(chain, 0);
121.   
122.       if ((store_ctx = X509_STORE_CTX_new()) == NULL)

include/openssl/x509.h:169:1: start of procedure sk_X509_value()
  167.   typedef struct x509_cinf_st X509_CINF;
  168.   
  169. > DEFINE_STACK_OF(X509)
  170.   
  171.   /* This is used for a table of trust checking functions */

crypto/stack/stack.c:323:1: start of procedure sk_value()
    321.   }
    322.   
    323. > void *sk_value(const _STACK *st, int i)
    324.   {
    325.       if (!st || (i < 0) || (i >= st->num))

crypto/stack/stack.c:325:10: Taking true branch
    323.   void *sk_value(const _STACK *st, int i)
    324.   {
    325.       if (!st || (i < 0) || (i >= st->num))
                    ^
    326.           return NULL;
    327.       return st->data[i];

crypto/stack/stack.c:326:9: 
    324.   {
    325.       if (!st || (i < 0) || (i >= st->num))
    326. >         return NULL;
    327.       return st->data[i];
    328.   }

crypto/stack/stack.c:328:1: return from a call to sk_value
    326.           return NULL;
    327.       return st->data[i];
    328. > }
    329.   
    330.   void *sk_set(_STACK *st, int i, void *value)

include/openssl/x509.h:169:1: return from a call to sk_X509_value
  167.   typedef struct x509_cinf_st X509_CINF;
  168.   
  169. > DEFINE_STACK_OF(X509)
  170.   
  171.   /* This is used for a table of trust checking functions */

test/danetest.c:122:9: 
120.       X509 *cert = sk_X509_value(chain, 0);
121.   
122. >     if ((store_ctx = X509_STORE_CTX_new()) == NULL)
123.           return -1;
124.   

crypto/x509/x509_vfy.c:2084:1: start of procedure X509_STORE_CTX_new()
  2082.   }
  2083.   
  2084. > X509_STORE_CTX *X509_STORE_CTX_new(void)
  2085.   {
  2086.       X509_STORE_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));

crypto/x509/x509_vfy.c:2086:5: 
  2084.   X509_STORE_CTX *X509_STORE_CTX_new(void)
  2085.   {
  2086. >     X509_STORE_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
  2087.   
  2088.       if (ctx == NULL) {

crypto/mem.c:156:1: start of procedure CRYPTO_zalloc()
    154.   }
    155.   
    156. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    157.   {
    158.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:158:5: 
    156.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    157.   {
    158. >     void *ret = CRYPTO_malloc(num, file, line);
    159.   
    160.       if (ret != NULL)

crypto/mem.c:119:1: start of procedure CRYPTO_malloc()
      117.   }
      118.   
      119. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      120.   {
      121.       void *ret = NULL;

crypto/mem.c:121:5: 
      119.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      120.   {
      121. >     void *ret = NULL;
      122.   
      123.       if (num <= 0)

crypto/mem.c:123:9: Taking false branch
      121.       void *ret = NULL;
      122.   
      123.       if (num <= 0)
                     ^
      124.           return NULL;
      125.   

crypto/mem.c:126:5: 
      124.           return NULL;
      125.   
      126. >     allow_customize = 0;
      127.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      128.       if (call_malloc_debug) {

crypto/mem.c:136:5: 
      134.       }
      135.   #else
      136. >     (void)file;
      137.       (void)line;
      138.       ret = malloc(num);

crypto/mem.c:137:5: 
      135.   #else
      136.       (void)file;
      137. >     (void)line;
      138.       ret = malloc(num);
      139.   #endif

crypto/mem.c:138:5: 
      136.       (void)file;
      137.       (void)line;
      138. >     ret = malloc(num);
      139.   #endif
      140.   

crypto/mem.c:153:5: 
      151.   #endif
      152.   
      153. >     return ret;
      154.   }
      155.   

crypto/mem.c:154:1: return from a call to CRYPTO_malloc
      152.   
      153.       return ret;
      154. > }
      155.   
      156.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:160:9: Taking true branch
    158.       void *ret = CRYPTO_malloc(num, file, line);
    159.   
    160.       if (ret != NULL)
                   ^
    161.           memset(ret, 0, num);
    162.       return ret;

crypto/mem.c:161:9: 
    159.   
    160.       if (ret != NULL)
    161. >         memset(ret, 0, num);
    162.       return ret;
    163.   }

crypto/mem.c:162:5: 
    160.       if (ret != NULL)
    161.           memset(ret, 0, num);
    162. >     return ret;
    163.   }
    164.   

crypto/mem.c:163:1: return from a call to CRYPTO_zalloc
    161.           memset(ret, 0, num);
    162.       return ret;
    163. > }
    164.   
    165.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/x509/x509_vfy.c:2088:9: Taking false branch
  2086.       X509_STORE_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
  2087.   
  2088.       if (ctx == NULL) {
                  ^
  2089.           X509err(X509_F_X509_STORE_CTX_NEW, ERR_R_MALLOC_FAILURE);
  2090.           return NULL;

crypto/x509/x509_vfy.c:2092:5: 
  2090.           return NULL;
  2091.       }
  2092. >     return ctx;
  2093.   }
  2094.   

crypto/x509/x509_vfy.c:2093:1: return from a call to X509_STORE_CTX_new
  2091.       }
  2092.       return ctx;
  2093. > }
  2094.   
  2095.   void X509_STORE_CTX_free(X509_STORE_CTX *ctx)

test/danetest.c:122:9: Taking false branch
120.       X509 *cert = sk_X509_value(chain, 0);
121.   
122.       if ((store_ctx = X509_STORE_CTX_new()) == NULL)
               ^
123.           return -1;
124.   

test/danetest.c:125:10: Taking true branch
123.           return -1;
124.   
125.       if (!X509_STORE_CTX_init(store_ctx, store, cert, chain))
                ^
126.   	return 0;
127.       X509_STORE_CTX_set_ex_data(store_ctx, store_ctx_idx, ssl);

test/danetest.c:126:2: 
124.   
125.       if (!X509_STORE_CTX_init(store_ctx, store, cert, chain))
126. > 	return 0;
127.       X509_STORE_CTX_set_ex_data(store_ctx, store_ctx_idx, ssl);
128.   
