crypto/async/async.c:416: error: MEMORY_LEAK
  memory dynamically allocated to `return` by call to `CRYPTO_zalloc()` at line 379, column 12 is not reachable after line 416, column 5.
Showing all 58 steps of the trace


crypto/async/async.c:362:1: start of procedure ASYNC_init_thread()
360.   }
361.   
362. > int ASYNC_init_thread(size_t max_size, size_t init_size)
363.   {
364.       async_pool *pool;

crypto/async/async.c:365:5: 
363.   {
364.       async_pool *pool;
365. >     size_t curr_size = 0;
366.   
367.       if (init_size > max_size) {

crypto/async/async.c:367:9: Taking false branch
365.       size_t curr_size = 0;
366.   
367.       if (init_size > max_size) {
               ^
368.           ASYNCerr(ASYNC_F_ASYNC_INIT_THREAD, ASYNC_R_INVALID_POOL_SIZE);
369.           return 0;

crypto/async/async.c:372:10: Taking false branch
370.       }
371.   
372.       if (!OPENSSL_init_crypto(OPENSSL_INIT_ASYNC, NULL)) {
                ^
373.           return 0;
374.       }

crypto/async/async.c:375:10: Taking false branch
373.           return 0;
374.       }
375.       if (!ossl_init_thread_start(OPENSSL_INIT_THREAD_ASYNC)) {
                ^
376.           return 0;
377.       }

crypto/async/async.c:379:5: 
377.       }
378.   
379. >     pool = OPENSSL_zalloc(sizeof *pool);
380.       if (pool == NULL) {
381.           ASYNCerr(ASYNC_F_ASYNC_INIT_THREAD, ERR_R_MALLOC_FAILURE);

crypto/mem.c:146:1: start of procedure CRYPTO_zalloc()
  144.   }
  145.   
  146. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
  147.   {
  148.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:148:5: 
  146.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
  147.   {
  148. >     void *ret = CRYPTO_malloc(num, file, line);
  149.   
  150.       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 (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:123:9: Taking false branch
    121.       void *ret = NULL;
    122.   
    123.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                   ^
    124.           return malloc_impl(num, file, line);
    125.   

crypto/mem.c:126:9: Taking false branch
    124.           return malloc_impl(num, file, line);
    125.   
    126.       if (num <= 0)
                   ^
    127.           return NULL;
    128.   

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

crypto/mem.c:139:5: 
    137.       }
    138.   #else
    139. >     osslargused(file); osslargused(line);
    140.       ret = malloc(num);
    141.   #endif

crypto/mem.c:139:24: 
    137.       }
    138.   #else
    139. >     osslargused(file); osslargused(line);
    140.       ret = malloc(num);
    141.   #endif

crypto/mem.c:140:5: 
    138.   #else
    139.       osslargused(file); osslargused(line);
    140. >     ret = malloc(num);
    141.   #endif
    142.   

crypto/mem.c:143:5: 
    141.   #endif
    142.   
    143. >     return ret;
    144.   }
    145.   

crypto/mem.c:144:1: return from a call to CRYPTO_malloc
    142.   
    143.       return ret;
    144. > }
    145.   
    146.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:150:9: Taking true branch
  148.       void *ret = CRYPTO_malloc(num, file, line);
  149.   
  150.       if (ret != NULL)
                 ^
  151.           memset(ret, 0, num);
  152.       return ret;

crypto/mem.c:151:9: 
  149.   
  150.       if (ret != NULL)
  151. >         memset(ret, 0, num);
  152.       return ret;
  153.   }

crypto/mem.c:152:5: 
  150.       if (ret != NULL)
  151.           memset(ret, 0, num);
  152. >     return ret;
  153.   }
  154.   

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

crypto/async/async.c:380:9: Taking false branch
378.   
379.       pool = OPENSSL_zalloc(sizeof *pool);
380.       if (pool == NULL) {
               ^
381.           ASYNCerr(ASYNC_F_ASYNC_INIT_THREAD, ERR_R_MALLOC_FAILURE);
382.           return 0;

crypto/async/async.c:385:5: 
383.       }
384.   
385. >     pool->jobs = sk_ASYNC_JOB_new_null();
386.       if (pool->jobs == NULL) {
387.           ASYNCerr(ASYNC_F_ASYNC_INIT_THREAD, ERR_R_MALLOC_FAILURE);

crypto/async/async_locl.h:103:1: start of procedure sk_ASYNC_JOB_new_null()
  101.   };
  102.   
  103. > DEFINE_STACK_OF(ASYNC_JOB)
  104.   
  105.   struct async_pool_st {

crypto/stack/stack.c:144:1: start of procedure sk_new_null()
    142.   }
    143.   
    144. > _STACK *sk_new_null(void)
    145.   {
    146.       return sk_new((int (*)(const void *, const void *))0);

crypto/stack/stack.c:146:5: Skipping sk_new(): empty list of specs
    144.   _STACK *sk_new_null(void)
    145.   {
    146.       return sk_new((int (*)(const void *, const void *))0);
               ^
    147.   }
    148.   

crypto/stack/stack.c:147:1: return from a call to sk_new_null
    145.   {
    146.       return sk_new((int (*)(const void *, const void *))0);
    147. > }
    148.   
    149.   _STACK *sk_new(int (*c) (const void *, const void *))

crypto/async/async_locl.h:103:1: return from a call to sk_ASYNC_JOB_new_null
  101.   };
  102.   
  103. > DEFINE_STACK_OF(ASYNC_JOB)
  104.   
  105.   struct async_pool_st {

crypto/async/async.c:386:9: Taking false branch
384.   
385.       pool->jobs = sk_ASYNC_JOB_new_null();
386.       if (pool->jobs == NULL) {
               ^
387.           ASYNCerr(ASYNC_F_ASYNC_INIT_THREAD, ERR_R_MALLOC_FAILURE);
388.           OPENSSL_free(pool);

crypto/async/async.c:392:5: 
390.       }
391.   
392. >     pool->max_size = max_size;
393.   
394.       /* Pre-create jobs as required */

crypto/async/async.c:395:12: Loop condition is true. Entering loop body
393.   
394.       /* Pre-create jobs as required */
395.       while (init_size--) {
                  ^
396.           ASYNC_JOB *job;
397.           job = async_job_new();

crypto/async/async.c:397:9: Skipping async_job_new(): empty list of specs
395.       while (init_size--) {
396.           ASYNC_JOB *job;
397.           job = async_job_new();
               ^
398.           if (job == NULL || !async_fibre_makecontext(&job->fibrectx)) {
399.               /*

crypto/async/async.c:398:13: Taking false branch
396.           ASYNC_JOB *job;
397.           job = async_job_new();
398.           if (job == NULL || !async_fibre_makecontext(&job->fibrectx)) {
                   ^
399.               /*
400.                * Not actually fatal because we already created the pool, just

crypto/async/async.c:398:29: 
396.           ASYNC_JOB *job;
397.           job = async_job_new();
398. >         if (job == NULL || !async_fibre_makecontext(&job->fibrectx)) {
399.               /*
400.                * Not actually fatal because we already created the pool, just

crypto/async/arch/async_posix.c:68:1: start of procedure async_fibre_makecontext()
  66.   
  67.   
  68. > int async_fibre_makecontext(async_fibre *fibre)
  69.   {
  70.       fibre->env_init = 0;

crypto/async/arch/async_posix.c:70:5: 
  68.   int async_fibre_makecontext(async_fibre *fibre)
  69.   {
  70. >     fibre->env_init = 0;
  71.       if (getcontext(&fibre->fibre) == 0) {
  72.           fibre->fibre.uc_stack.ss_sp = OPENSSL_malloc(STACKSIZE);

crypto/async/arch/async_posix.c:71:9: Taking true branch
  69.   {
  70.       fibre->env_init = 0;
  71.       if (getcontext(&fibre->fibre) == 0) {
                ^
  72.           fibre->fibre.uc_stack.ss_sp = OPENSSL_malloc(STACKSIZE);
  73.           if (fibre->fibre.uc_stack.ss_sp != NULL) {

crypto/async/arch/async_posix.c:72:9: 
  70.       fibre->env_init = 0;
  71.       if (getcontext(&fibre->fibre) == 0) {
  72. >         fibre->fibre.uc_stack.ss_sp = OPENSSL_malloc(STACKSIZE);
  73.           if (fibre->fibre.uc_stack.ss_sp != NULL) {
  74.               fibre->fibre.uc_stack.ss_size = STACKSIZE;

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 (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:123:9: Taking true branch
    121.       void *ret = NULL;
    122.   
    123.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                   ^
    124.           return malloc_impl(num, file, line);
    125.   

crypto/mem.c:123:32: Taking true branch
    121.       void *ret = NULL;
    122.   
    123.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                                          ^
    124.           return malloc_impl(num, file, line);
    125.   

crypto/mem.c:124:9: Skipping __function_pointer__(): unresolved function pointer
    122.   
    123.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
    124.           return malloc_impl(num, file, line);
                   ^
    125.   
    126.       if (num <= 0)

crypto/mem.c:144:1: return from a call to CRYPTO_malloc
    142.   
    143.       return ret;
    144. > }
    145.   
    146.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/async/arch/async_posix.c:73:13: Taking false branch
  71.       if (getcontext(&fibre->fibre) == 0) {
  72.           fibre->fibre.uc_stack.ss_sp = OPENSSL_malloc(STACKSIZE);
  73.           if (fibre->fibre.uc_stack.ss_sp != NULL) {
                    ^
  74.               fibre->fibre.uc_stack.ss_size = STACKSIZE;
  75.               fibre->fibre.uc_link = NULL;

crypto/async/arch/async_posix.c:82:5: 
  80.           fibre->fibre.uc_stack.ss_sp = NULL;
  81.       }
  82. >     return 0;
  83.   }
  84.   

crypto/async/arch/async_posix.c:83:1: return from a call to async_fibre_makecontext
  81.       }
  82.       return 0;
  83. > }
  84.   
  85.   void async_fibre_free(async_fibre *fibre)

crypto/async/async.c:398:29: Taking true branch
396.           ASYNC_JOB *job;
397.           job = async_job_new();
398.           if (job == NULL || !async_fibre_makecontext(&job->fibrectx)) {
                                   ^
399.               /*
400.                * Not actually fatal because we already created the pool, just

crypto/async/async.c:403:13: Skipping async_job_free(): empty list of specs
401.                * skip creation of any more jobs
402.                */
403.               async_job_free(job);
                   ^
404.               break;
405.           }

crypto/async/async.c:410:5: 
408.           curr_size++;
409.       }
410. >     pool->curr_size = curr_size;
411.       if (!CRYPTO_THREAD_set_local(&poolkey, pool)) {
412.           ASYNCerr(ASYNC_F_ASYNC_INIT_THREAD, ASYNC_R_FAILED_TO_SET_POOL);

crypto/async/async.c:411:10: 
409.       }
410.       pool->curr_size = curr_size;
411. >     if (!CRYPTO_THREAD_set_local(&poolkey, pool)) {
412.           ASYNCerr(ASYNC_F_ASYNC_INIT_THREAD, ASYNC_R_FAILED_TO_SET_POOL);
413.           goto err;

crypto/threads_pthread.c:123:1: start of procedure CRYPTO_THREAD_set_local()
  121.   }
  122.   
  123. > int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val)
  124.   {
  125.       if (pthread_setspecific(*key, val) != 0)

crypto/threads_pthread.c:125:9: Taking false branch
  123.   int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val)
  124.   {
  125.       if (pthread_setspecific(*key, val) != 0)
                 ^
  126.           return 0;
  127.   

crypto/threads_pthread.c:128:5: 
  126.           return 0;
  127.   
  128. >     return 1;
  129.   }
  130.   

crypto/threads_pthread.c:129:1: return from a call to CRYPTO_THREAD_set_local
  127.   
  128.       return 1;
  129. > }
  130.   
  131.   int CRYPTO_THREAD_cleanup_local(CRYPTO_THREAD_LOCAL *key)

crypto/async/async.c:411:10: Taking false branch
409.       }
410.       pool->curr_size = curr_size;
411.       if (!CRYPTO_THREAD_set_local(&poolkey, pool)) {
                ^
412.           ASYNCerr(ASYNC_F_ASYNC_INIT_THREAD, ASYNC_R_FAILED_TO_SET_POOL);
413.           goto err;

crypto/async/async.c:416:5: 
414.       }
415.   
416. >     return 1;
417.   err:
418.       async_free_pool_internal(pool);
