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


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

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

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

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

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

crypto/async/async.c:377:5: 
375.       }
376.   
377. >     pool = OPENSSL_zalloc(sizeof *pool);
378.       if (pool == NULL) {
379.           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:378:9: Taking false branch
376.   
377.       pool = OPENSSL_zalloc(sizeof *pool);
378.       if (pool == NULL) {
               ^
379.           ASYNCerr(ASYNC_F_ASYNC_INIT_THREAD, ERR_R_MALLOC_FAILURE);
380.           return 0;

crypto/async/async.c:383:5: 
381.       }
382.   
383. >     pool->jobs = sk_ASYNC_JOB_new_null();
384.       if (pool->jobs == NULL) {
385.           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:384:9: Taking false branch
382.   
383.       pool->jobs = sk_ASYNC_JOB_new_null();
384.       if (pool->jobs == NULL) {
               ^
385.           ASYNCerr(ASYNC_F_ASYNC_INIT_THREAD, ERR_R_MALLOC_FAILURE);
386.           OPENSSL_free(pool);

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

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

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

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

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

crypto/async/arch/async_posix.c:72:1: start of procedure async_fibre_makecontext()
  70.   }
  71.   
  72. > int async_fibre_makecontext(async_fibre *fibre)
  73.   {
  74.       fibre->env_init = 0;

crypto/async/arch/async_posix.c:74:5: 
  72.   int async_fibre_makecontext(async_fibre *fibre)
  73.   {
  74. >     fibre->env_init = 0;
  75.       if (getcontext(&fibre->fibre) == 0) {
  76.           fibre->fibre.uc_stack.ss_sp = OPENSSL_malloc(STACKSIZE);

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

crypto/async/arch/async_posix.c:76:9: 
  74.       fibre->env_init = 0;
  75.       if (getcontext(&fibre->fibre) == 0) {
  76. >         fibre->fibre.uc_stack.ss_sp = OPENSSL_malloc(STACKSIZE);
  77.           if (fibre->fibre.uc_stack.ss_sp != NULL) {
  78.               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:77:13: Taking false branch
  75.       if (getcontext(&fibre->fibre) == 0) {
  76.           fibre->fibre.uc_stack.ss_sp = OPENSSL_malloc(STACKSIZE);
  77.           if (fibre->fibre.uc_stack.ss_sp != NULL) {
                    ^
  78.               fibre->fibre.uc_stack.ss_size = STACKSIZE;
  79.               fibre->fibre.uc_link = NULL;

crypto/async/arch/async_posix.c:86:5: 
  84.           fibre->fibre.uc_stack.ss_sp = NULL;
  85.       }
  86. >     return 0;
  87.   }
  88.   

crypto/async/arch/async_posix.c:87:1: return from a call to async_fibre_makecontext
  85.       }
  86.       return 0;
  87. > }
  88.   
  89.   void async_fibre_free(async_fibre *fibre)

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

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

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

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

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

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

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

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

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

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