test/crltest.c:274: error: MEMORY_LEAK
  memory dynamically allocated by call to `X509_STORE_CTX_new()` at line 240, column 27 is not reachable after line 274, column 5.
Showing all 54 steps of the trace


test/crltest.c:237:1: start of procedure verify()
235.    * Returns a value from X509_V_ERR_xxx or X509_V_OK.
236.    */
237. > static int verify(X509 *leaf, X509 *root, STACK_OF(X509_CRL) *crls,
238.                     unsigned long flags)
239.   {

test/crltest.c:240:5: 
238.                     unsigned long flags)
239.   {
240. >     X509_STORE_CTX *ctx = X509_STORE_CTX_new();
241.       X509_STORE *store = X509_STORE_new();
242.       X509_VERIFY_PARAM *param = X509_VERIFY_PARAM_new();

crypto/x509/x509_vfy.c:2201:1: start of procedure X509_STORE_CTX_new()
  2199.   }
  2200.   
  2201. > X509_STORE_CTX *X509_STORE_CTX_new(void)
  2202.   {
  2203.       X509_STORE_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));

crypto/x509/x509_vfy.c:2203:5: 
  2201.   X509_STORE_CTX *X509_STORE_CTX_new(void)
  2202.   {
  2203. >     X509_STORE_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
  2204.   
  2205.       if (ctx == NULL) {

crypto/mem.c:186:1: start of procedure CRYPTO_zalloc()
    184.   }
    185.   
    186. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    187.   {
    188.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:188:5: 
    186.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    187.   {
    188. >     void *ret = CRYPTO_malloc(num, file, line);
    189.   
    190.       FAILTEST();

crypto/mem.c:158:1: start of procedure CRYPTO_malloc()
      156.   #endif
      157.   
      158. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      159.   {
      160.       void *ret = NULL;

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

crypto/mem.c:162:9: Taking false branch
      160.       void *ret = NULL;
      161.   
      162.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                     ^
      163.           return malloc_impl(num, file, line);
      164.   

crypto/mem.c:165:9: Taking false branch
      163.           return malloc_impl(num, file, line);
      164.   
      165.       if (num <= 0)
                     ^
      166.           return NULL;
      167.   

crypto/mem.c:169:5: 
      167.   
      168.       FAILTEST();
      169. >     allow_customize = 0;
      170.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      171.       if (call_malloc_debug) {

crypto/mem.c:179:5: 
      177.       }
      178.   #else
      179. >     osslargused(file); osslargused(line);
      180.       ret = malloc(num);
      181.   #endif

crypto/mem.c:179:24: 
      177.       }
      178.   #else
      179. >     osslargused(file); osslargused(line);
      180.       ret = malloc(num);
      181.   #endif

crypto/mem.c:180:5: 
      178.   #else
      179.       osslargused(file); osslargused(line);
      180. >     ret = malloc(num);
      181.   #endif
      182.   

crypto/mem.c:183:5: 
      181.   #endif
      182.   
      183. >     return ret;
      184.   }
      185.   

crypto/mem.c:184:1: return from a call to CRYPTO_malloc
      182.   
      183.       return ret;
      184. > }
      185.   
      186.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:191:9: Taking true branch
    189.   
    190.       FAILTEST();
    191.       if (ret != NULL)
                   ^
    192.           memset(ret, 0, num);
    193.       return ret;

crypto/mem.c:192:9: 
    190.       FAILTEST();
    191.       if (ret != NULL)
    192. >         memset(ret, 0, num);
    193.       return ret;
    194.   }

crypto/mem.c:193:5: 
    191.       if (ret != NULL)
    192.           memset(ret, 0, num);
    193. >     return ret;
    194.   }
    195.   

crypto/mem.c:194:1: return from a call to CRYPTO_zalloc
    192.           memset(ret, 0, num);
    193.       return ret;
    194. > }
    195.   
    196.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/x509/x509_vfy.c:2205:9: Taking false branch
  2203.       X509_STORE_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
  2204.   
  2205.       if (ctx == NULL) {
                  ^
  2206.           X509err(X509_F_X509_STORE_CTX_NEW, ERR_R_MALLOC_FAILURE);
  2207.           return NULL;

crypto/x509/x509_vfy.c:2209:5: 
  2207.           return NULL;
  2208.       }
  2209. >     return ctx;
  2210.   }
  2211.   

crypto/x509/x509_vfy.c:2210:1: return from a call to X509_STORE_CTX_new
  2208.       }
  2209.       return ctx;
  2210. > }
  2211.   
  2212.   void X509_STORE_CTX_free(X509_STORE_CTX *ctx)

test/crltest.c:241:5: Skipping X509_STORE_new(): empty list of specs
239.   {
240.       X509_STORE_CTX *ctx = X509_STORE_CTX_new();
241.       X509_STORE *store = X509_STORE_new();
           ^
242.       X509_VERIFY_PARAM *param = X509_VERIFY_PARAM_new();
243.       STACK_OF(X509) *roots = sk_X509_new_null();

test/crltest.c:242:5: Skipping X509_VERIFY_PARAM_new(): empty list of specs
240.       X509_STORE_CTX *ctx = X509_STORE_CTX_new();
241.       X509_STORE *store = X509_STORE_new();
242.       X509_VERIFY_PARAM *param = X509_VERIFY_PARAM_new();
           ^
243.       STACK_OF(X509) *roots = sk_X509_new_null();
244.       int status = X509_V_ERR_UNSPECIFIED;

test/crltest.c:243:5: 
241.       X509_STORE *store = X509_STORE_new();
242.       X509_VERIFY_PARAM *param = X509_VERIFY_PARAM_new();
243. >     STACK_OF(X509) *roots = sk_X509_new_null();
244.       int status = X509_V_ERR_UNSPECIFIED;
245.   

include/openssl/x509.h:97:1: start of procedure sk_X509_new_null()
  95.   typedef struct x509_cinf_st X509_CINF;
  96.   
  97. > DEFINE_STACK_OF(X509)
  98.   
  99.   /* This is used for a table of trust checking functions */

crypto/stack/stack.c:99:1: start of procedure OPENSSL_sk_new_null()
    97.   }
    98.   
    99. > OPENSSL_STACK *OPENSSL_sk_new_null(void)
    100.   {
    101.       return OPENSSL_sk_new((OPENSSL_sk_compfunc)NULL);

crypto/stack/stack.c:101:5: Skipping OPENSSL_sk_new(): empty list of specs
    99.   OPENSSL_STACK *OPENSSL_sk_new_null(void)
    100.   {
    101.       return OPENSSL_sk_new((OPENSSL_sk_compfunc)NULL);
               ^
    102.   }
    103.   

crypto/stack/stack.c:102:1: return from a call to OPENSSL_sk_new_null
    100.   {
    101.       return OPENSSL_sk_new((OPENSSL_sk_compfunc)NULL);
    102. > }
    103.   
    104.   OPENSSL_STACK *OPENSSL_sk_new(OPENSSL_sk_compfunc c)

include/openssl/x509.h:97:1: return from a call to sk_X509_new_null
  95.   typedef struct x509_cinf_st X509_CINF;
  96.   
  97. > DEFINE_STACK_OF(X509)
  98.   
  99.   /* This is used for a table of trust checking functions */

test/crltest.c:244:5: 
242.       X509_VERIFY_PARAM *param = X509_VERIFY_PARAM_new();
243.       STACK_OF(X509) *roots = sk_X509_new_null();
244. >     int status = X509_V_ERR_UNSPECIFIED;
245.   
246.       if (ctx == NULL || store == NULL || param == NULL || roots == NULL)

test/crltest.c:246:9: Taking false branch
244.       int status = X509_V_ERR_UNSPECIFIED;
245.   
246.       if (ctx == NULL || store == NULL || param == NULL || roots == NULL)
               ^
247.           goto err;
248.   

test/crltest.c:246:24: Taking false branch
244.       int status = X509_V_ERR_UNSPECIFIED;
245.   
246.       if (ctx == NULL || store == NULL || param == NULL || roots == NULL)
                              ^
247.           goto err;
248.   

test/crltest.c:246:41: Taking true branch
244.       int status = X509_V_ERR_UNSPECIFIED;
245.   
246.       if (ctx == NULL || store == NULL || param == NULL || roots == NULL)
                                               ^
247.           goto err;
248.   

test/crltest.c:271:1: 
269.       status = X509_verify_cert(ctx) == 1 ? X509_V_OK
270.                                           : X509_STORE_CTX_get_error(ctx);
271. > err:
272.       sk_X509_pop_free(roots, X509_free);
273.       sk_X509_CRL_pop_free(crls, X509_CRL_free);

test/crltest.c:272:5: 
270.                                           : X509_STORE_CTX_get_error(ctx);
271.   err:
272. >     sk_X509_pop_free(roots, X509_free);
273.       sk_X509_CRL_pop_free(crls, X509_CRL_free);
274.       X509_STORE_CTX_free(ctx);

include/openssl/x509.h:97:1: start of procedure sk_X509_pop_free()
  95.   typedef struct x509_cinf_st X509_CINF;
  96.   
  97. > DEFINE_STACK_OF(X509)
  98.   
  99.   /* This is used for a table of trust checking functions */

include/openssl/x509.h:97:1: return from a call to sk_X509_pop_free
  95.   typedef struct x509_cinf_st X509_CINF;
  96.   
  97. > DEFINE_STACK_OF(X509)
  98.   
  99.   /* This is used for a table of trust checking functions */

test/crltest.c:273:5: 
271.   err:
272.       sk_X509_pop_free(roots, X509_free);
273. >     sk_X509_CRL_pop_free(crls, X509_CRL_free);
274.       X509_STORE_CTX_free(ctx);
275.       X509_STORE_free(store);

include/openssl/x509.h:226:1: start of procedure sk_X509_CRL_pop_free()
  224.   typedef struct X509_crl_info_st X509_CRL_INFO;
  225.   
  226. > DEFINE_STACK_OF(X509_CRL)
  227.   
  228.   typedef struct private_key_st {

include/openssl/x509.h:226:1: return from a call to sk_X509_CRL_pop_free
  224.   typedef struct X509_crl_info_st X509_CRL_INFO;
  225.   
  226. > DEFINE_STACK_OF(X509_CRL)
  227.   
  228.   typedef struct private_key_st {

test/crltest.c:274:5: 
272.       sk_X509_pop_free(roots, X509_free);
273.       sk_X509_CRL_pop_free(crls, X509_CRL_free);
274. >     X509_STORE_CTX_free(ctx);
275.       X509_STORE_free(store);
276.       return status;

crypto/x509/x509_vfy.c:2212:1: start of procedure X509_STORE_CTX_free()
  2210.   }
  2211.   
  2212. > void X509_STORE_CTX_free(X509_STORE_CTX *ctx)
  2213.   {
  2214.       if (ctx == NULL)

crypto/x509/x509_vfy.c:2214:9: Taking false branch
  2212.   void X509_STORE_CTX_free(X509_STORE_CTX *ctx)
  2213.   {
  2214.       if (ctx == NULL)
                  ^
  2215.           return;
  2216.   

crypto/x509/x509_vfy.c:2217:5: Skipping X509_STORE_CTX_cleanup(): empty list of specs
  2215.           return;
  2216.   
  2217.       X509_STORE_CTX_cleanup(ctx);
              ^
  2218.       OPENSSL_free(ctx);
  2219.   }

crypto/x509/x509_vfy.c:2218:5: 
  2216.   
  2217.       X509_STORE_CTX_cleanup(ctx);
  2218. >     OPENSSL_free(ctx);
  2219.   }
  2220.   

crypto/mem.c:253:1: start of procedure CRYPTO_free()
    251.   }
    252.   
    253. > void CRYPTO_free(void *str, const char *file, int line)
    254.   {
    255.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:255:9: Taking true branch
    253.   void CRYPTO_free(void *str, const char *file, int line)
    254.   {
    255.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    256.           free_impl(str, file, line);
    257.           return;

crypto/mem.c:255:30: Taking true branch
    253.   void CRYPTO_free(void *str, const char *file, int line)
    254.   {
    255.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    256.           free_impl(str, file, line);
    257.           return;

crypto/mem.c:256:9: Skipping __function_pointer__(): unresolved function pointer
    254.   {
    255.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    256.           free_impl(str, file, line);
                   ^
    257.           return;
    258.       }

crypto/mem.c:257:9: 
    255.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    256.           free_impl(str, file, line);
    257. >         return;
    258.       }
    259.   

crypto/mem.c:271:1: return from a call to CRYPTO_free
    269.       free(str);
    270.   #endif
    271. > }
    272.   
    273.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/x509/x509_vfy.c:2219:1: return from a call to X509_STORE_CTX_free
  2217.       X509_STORE_CTX_cleanup(ctx);
  2218.       OPENSSL_free(ctx);
  2219. > }
  2220.   
  2221.   int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509,

static int verify(X509 *leaf, X509 *root, STACK_OF(X509_CRL) *crls,
                  unsigned long flags)
{
    X509_STORE_CTX *ctx = X509_STORE_CTX_new();
    X509_STORE *store = X509_STORE_new();
    X509_VERIFY_PARAM *param = X509_VERIFY_PARAM_new();
    STACK_OF(X509) *roots = sk_X509_new_null();
    int status = X509_V_ERR_UNSPECIFIED;
    if (ctx == NULL || store == NULL || param == NULL || roots == NULL)
        goto err;
    X509_up_ref(root);
    if (!sk_X509_push(roots, root))
        goto err;
    if (!X509_STORE_CTX_init(ctx, store, leaf, NULL))
        goto err;
    X509_STORE_CTX_set0_trusted_stack(ctx, roots);
    X509_STORE_CTX_set0_crls(ctx, crls);
    X509_VERIFY_PARAM_set_time(param, PARAM_TIME);
    if (X509_VERIFY_PARAM_get_time(param) != PARAM_TIME) {
        fprintf(stderr, "set_time/get_time mismatch.\n");
        goto err;
    }
    X509_VERIFY_PARAM_set_depth(param, 16);
    if (flags)
        X509_VERIFY_PARAM_set_flags(param, flags);
    X509_STORE_CTX_set0_param(ctx, param);
    ERR_clear_error();
    status = X509_verify_cert(ctx) == 1 ? X509_V_OK
                                        : X509_STORE_CTX_get_error(ctx);
err:
    sk_X509_pop_free(roots, X509_free);
    sk_X509_CRL_pop_free(crls, X509_CRL_free);
    X509_STORE_CTX_free(ctx);
    X509_STORE_free(store);
    return status;
}
['static int verify(X509 *leaf, X509 *root, STACK_OF(X509_CRL) *crls,\n                  unsigned long flags)\n{\n    X509_STORE_CTX *ctx = X509_STORE_CTX_new();\n    X509_STORE *store = X509_STORE_new();\n    X509_VERIFY_PARAM *param = X509_VERIFY_PARAM_new();\n    STACK_OF(X509) *roots = sk_X509_new_null();\n    int status = X509_V_ERR_UNSPECIFIED;\n    if (ctx == NULL || store == NULL || param == NULL || roots == NULL)\n        goto err;\n    X509_up_ref(root);\n    if (!sk_X509_push(roots, root))\n        goto err;\n    if (!X509_STORE_CTX_init(ctx, store, leaf, NULL))\n        goto err;\n    X509_STORE_CTX_set0_trusted_stack(ctx, roots);\n    X509_STORE_CTX_set0_crls(ctx, crls);\n    X509_VERIFY_PARAM_set_time(param, PARAM_TIME);\n    if (X509_VERIFY_PARAM_get_time(param) != PARAM_TIME) {\n        fprintf(stderr, "set_time/get_time mismatch.\\n");\n        goto err;\n    }\n    X509_VERIFY_PARAM_set_depth(param, 16);\n    if (flags)\n        X509_VERIFY_PARAM_set_flags(param, flags);\n    X509_STORE_CTX_set0_param(ctx, param);\n    ERR_clear_error();\n    status = X509_verify_cert(ctx) == 1 ? X509_V_OK\n                                        : X509_STORE_CTX_get_error(ctx);\nerr:\n    sk_X509_pop_free(roots, X509_free);\n    sk_X509_CRL_pop_free(crls, X509_CRL_free);\n    X509_STORE_CTX_free(ctx);\n    X509_STORE_free(store);\n    return status;\n}', 'X509_STORE_CTX *X509_STORE_CTX_new(void)\n{\n    X509_STORE_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));\n    if (ctx == NULL) {\n        X509err(X509_F_X509_STORE_CTX_NEW, ERR_R_MALLOC_FAILURE);\n        return NULL;\n    }\n    return ctx;\n}', 'void *CRYPTO_zalloc(size_t num, const char *file, int line)\n{\n    void *ret = CRYPTO_malloc(num, file, line);\n    FAILTEST();\n    if (ret != NULL)\n        memset(ret, 0, num);\n    return ret;\n}', 'void *CRYPTO_malloc(size_t num, const char *file, int line)\n{\n    void *ret = NULL;\n    if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)\n        return malloc_impl(num, file, line);\n    if (num <= 0)\n        return NULL;\n    FAILTEST();\n    allow_customize = 0;\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_malloc(NULL, num, 0, file, line);\n        ret = malloc(num);\n        CRYPTO_mem_debug_malloc(ret, num, 1, file, line);\n    } else {\n        ret = malloc(num);\n    }\n#else\n    osslargused(file); osslargused(line);\n    ret = malloc(num);\n#endif\n    return ret;\n}', 'DEFINE_STACK_OF(X509)', 'OPENSSL_STACK *OPENSSL_sk_new_null(void)\n{\n    return OPENSSL_sk_new((OPENSSL_sk_compfunc)NULL);\n}', 'DEFINE_STACK_OF(X509_CRL)', 'void X509_STORE_CTX_free(X509_STORE_CTX *ctx)\n{\n    if (ctx == NULL)\n        return;\n    X509_STORE_CTX_cleanup(ctx);\n    OPENSSL_free(ctx);\n}', 'void CRYPTO_free(void *str, const char *file, int line)\n{\n    if (free_impl != NULL && free_impl != &CRYPTO_free) {\n        free_impl(str, file, line);\n        return;\n    }\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_free(str, 0, file, line);\n        free(str);\n        CRYPTO_mem_debug_free(str, 1, file, line);\n    } else {\n        free(str);\n    }\n#else\n    free(str);\n#endif\n}']