crypto/rand/drbg_lib.c:723: error: MEMORY_LEAK
  memory dynamically allocated by call to `CRYPTO_secure_zalloc()` at line 682, column 12 is not reachable after line 723, column 5.
Showing all 61 steps of the trace


crypto/rand/drbg_lib.c:673:1: start of procedure drbg_setup()
671.    * Returns a pointer to the new DRBG instance on success, NULL on failure.
672.    */
673. > static RAND_DRBG *drbg_setup(const char *name, RAND_DRBG *parent)
674.   {
675.       RAND_DRBG *drbg;

crypto/rand/drbg_lib.c:677:9: Taking false branch
675.       RAND_DRBG *drbg;
676.   
677.       if (name == NULL) {
               ^
678.           RANDerr(RAND_F_DRBG_SETUP, ERR_R_INTERNAL_ERROR);
679.           return NULL;

crypto/rand/drbg_lib.c:682:5: 
680.       }
681.   
682. >     drbg = OPENSSL_secure_zalloc(sizeof(RAND_DRBG));
683.       if (drbg == NULL)
684.           return NULL;

crypto/mem_sec.c:131:1: start of procedure CRYPTO_secure_zalloc()
  129.   }
  130.   
  131. > void *CRYPTO_secure_zalloc(size_t num, const char *file, int line)
  132.   {
  133.       void *ret = CRYPTO_secure_malloc(num, file, line);

crypto/mem_sec.c:133:5: 
  131.   void *CRYPTO_secure_zalloc(size_t num, const char *file, int line)
  132.   {
  133. >     void *ret = CRYPTO_secure_malloc(num, file, line);
  134.   
  135.       if (ret != NULL)

crypto/mem_sec.c:111:1: start of procedure CRYPTO_secure_malloc()
    109.   }
    110.   
    111. > void *CRYPTO_secure_malloc(size_t num, const char *file, int line)
    112.   {
    113.   #ifdef IMPLEMENTED

crypto/mem_sec.c:117:10: Taking true branch
    115.       size_t actual_size;
    116.   
    117.       if (!secure_mem_initialized) {
                    ^
    118.           return CRYPTO_malloc(num, file, line);
    119.       }

crypto/mem_sec.c:118:9: 
    116.   
    117.       if (!secure_mem_initialized) {
    118. >         return CRYPTO_malloc(num, file, line);
    119.       }
    120.       CRYPTO_THREAD_write_lock(sec_malloc_lock);

crypto/mem.c:192:1: start of procedure CRYPTO_malloc()
      190.   #endif
      191.   
      192. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      193.   {
      194.       void *ret = NULL;

crypto/mem.c:194:5: 
      192.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      193.   {
      194. >     void *ret = NULL;
      195.   
      196.       INCREMENT(malloc_count);

crypto/mem.c:197:9: Taking false branch
      195.   
      196.       INCREMENT(malloc_count);
      197.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                     ^
      198.           return malloc_impl(num, file, line);
      199.   

crypto/mem.c:200:9: Taking false branch
      198.           return malloc_impl(num, file, line);
      199.   
      200.       if (num == 0)
                     ^
      201.           return NULL;
      202.   

crypto/mem.c:204:5: 
      202.   
      203.       FAILTEST();
      204. >     allow_customize = 0;
      205.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      206.       if (call_malloc_debug) {

crypto/mem.c:214:5: 
      212.       }
      213.   #else
      214. >     (void)(file); (void)(line);
      215.       ret = malloc(num);
      216.   #endif

crypto/mem.c:214:19: 
      212.       }
      213.   #else
      214. >     (void)(file); (void)(line);
      215.       ret = malloc(num);
      216.   #endif

crypto/mem.c:215:5: 
      213.   #else
      214.       (void)(file); (void)(line);
      215. >     ret = malloc(num);
      216.   #endif
      217.   

crypto/mem.c:218:5: 
      216.   #endif
      217.   
      218. >     return ret;
      219.   }
      220.   

crypto/mem.c:219:1: return from a call to CRYPTO_malloc
      217.   
      218.       return ret;
      219. > }
      220.   
      221.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem_sec.c:129:1: return from a call to CRYPTO_secure_malloc
    127.       return CRYPTO_malloc(num, file, line);
    128.   #endif /* IMPLEMENTED */
    129. > }
    130.   
    131.   void *CRYPTO_secure_zalloc(size_t num, const char *file, int line)

crypto/mem_sec.c:135:9: Taking true branch
  133.       void *ret = CRYPTO_secure_malloc(num, file, line);
  134.   
  135.       if (ret != NULL)
                 ^
  136.           memset(ret, 0, num);
  137.       return ret;

crypto/mem_sec.c:136:9: 
  134.   
  135.       if (ret != NULL)
  136. >         memset(ret, 0, num);
  137.       return ret;
  138.   }

crypto/mem_sec.c:137:5: 
  135.       if (ret != NULL)
  136.           memset(ret, 0, num);
  137. >     return ret;
  138.   }
  139.   

crypto/mem_sec.c:138:1: return from a call to CRYPTO_secure_zalloc
  136.           memset(ret, 0, num);
  137.       return ret;
  138. > }
  139.   
  140.   void CRYPTO_secure_free(void *ptr, const char *file, int line)

crypto/rand/drbg_lib.c:683:9: Taking false branch
681.   
682.       drbg = OPENSSL_secure_zalloc(sizeof(RAND_DRBG));
683.       if (drbg == NULL)
               ^
684.           return NULL;
685.   

crypto/rand/drbg_lib.c:686:5: 
684.           return NULL;
685.   
686. >     drbg->lock = CRYPTO_THREAD_glock_new(name);
687.       if (drbg->lock == NULL) {
688.           RANDerr(RAND_F_DRBG_SETUP, RAND_R_FAILED_TO_CREATE_LOCK);

crypto/init.c:726:1: start of procedure CRYPTO_THREAD_glock_new()
  724.    * Create a new global lock, return NULL on error.
  725.    */
  726. > CRYPTO_RWLOCK *CRYPTO_THREAD_glock_new(const char *name)
  727.   {
  728.       static CRYPTO_ONCE glock_once = CRYPTO_ONCE_STATIC_INIT;

crypto/init.c:728:5: 
  726.   CRYPTO_RWLOCK *CRYPTO_THREAD_glock_new(const char *name)
  727.   {
  728. >     static CRYPTO_ONCE glock_once = CRYPTO_ONCE_STATIC_INIT;
  729.       GLOBAL_LOCK *newlock;
  730.   

crypto/init.c:731:9: Taking false branch
  729.       GLOBAL_LOCK *newlock;
  730.   
  731.       if (glock_lock == NULL && !RUN_ONCE(&glock_once, glock_init))
                 ^
  732.           return NULL;
  733.       if ((newlock = malloc(sizeof(*newlock))) == NULL)

crypto/init.c:733:9: Taking false branch
  731.       if (glock_lock == NULL && !RUN_ONCE(&glock_once, glock_init))
  732.           return NULL;
  733.       if ((newlock = malloc(sizeof(*newlock))) == NULL)
                 ^
  734.           return NULL;
  735.       if ((newlock->lock = CRYPTO_THREAD_lock_new()) == NULL) {

crypto/init.c:735:9: 
  733.       if ((newlock = malloc(sizeof(*newlock))) == NULL)
  734.           return NULL;
  735. >     if ((newlock->lock = CRYPTO_THREAD_lock_new()) == NULL) {
  736.           free(newlock);
  737.           return NULL;

crypto/threads_pthread.c:19:1: start of procedure CRYPTO_THREAD_lock_new()
    17.   # endif
    18.   
    19. > CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void)
    20.   {
    21.   # ifdef USE_RWLOCK

crypto/threads_pthread.c:22:5: 
    20.   {
    21.   # ifdef USE_RWLOCK
    22. >     CRYPTO_RWLOCK *lock = OPENSSL_zalloc(sizeof(pthread_rwlock_t));
    23.       if (lock == NULL)
    24.           return NULL;

crypto/mem.c:221:1: start of procedure CRYPTO_zalloc()
      219.   }
      220.   
      221. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
      222.   {
      223.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:223:5: 
      221.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
      222.   {
      223. >     void *ret = CRYPTO_malloc(num, file, line);
      224.   
      225.       FAILTEST();

crypto/mem.c:192:1: start of procedure CRYPTO_malloc()
        190.   #endif
        191.   
        192. > void *CRYPTO_malloc(size_t num, const char *file, int line)
        193.   {
        194.       void *ret = NULL;

crypto/mem.c:194:5: 
        192.   void *CRYPTO_malloc(size_t num, const char *file, int line)
        193.   {
        194. >     void *ret = NULL;
        195.   
        196.       INCREMENT(malloc_count);

crypto/mem.c:197:9: Taking true branch
        195.   
        196.       INCREMENT(malloc_count);
        197.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                       ^
        198.           return malloc_impl(num, file, line);
        199.   

crypto/mem.c:197:32: Taking true branch
        195.   
        196.       INCREMENT(malloc_count);
        197.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                                              ^
        198.           return malloc_impl(num, file, line);
        199.   

crypto/mem.c:198:9: Skipping __function_pointer__(): unresolved function pointer
        196.       INCREMENT(malloc_count);
        197.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
        198.           return malloc_impl(num, file, line);
                       ^
        199.   
        200.       if (num == 0)

crypto/mem.c:219:1: return from a call to CRYPTO_malloc
        217.   
        218.       return ret;
        219. > }
        220.   
        221.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:226:9: Taking true branch
      224.   
      225.       FAILTEST();
      226.       if (ret != NULL)
                     ^
      227.           memset(ret, 0, num);
      228.       return ret;

crypto/mem.c:227:9: 
      225.       FAILTEST();
      226.       if (ret != NULL)
      227. >         memset(ret, 0, num);
      228.       return ret;
      229.   }

crypto/mem.c:228:5: 
      226.       if (ret != NULL)
      227.           memset(ret, 0, num);
      228. >     return ret;
      229.   }
      230.   

crypto/mem.c:229:1: return from a call to CRYPTO_zalloc
      227.           memset(ret, 0, num);
      228.       return ret;
      229. > }
      230.   
      231.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/threads_pthread.c:23:9: Taking false branch
    21.   # ifdef USE_RWLOCK
    22.       CRYPTO_RWLOCK *lock = OPENSSL_zalloc(sizeof(pthread_rwlock_t));
    23.       if (lock == NULL)
                  ^
    24.           return NULL;
    25.   

crypto/threads_pthread.c:26:9: Taking true branch
    24.           return NULL;
    25.   
    26.       if (pthread_rwlock_init(lock, NULL) != 0) {
                  ^
    27.           OPENSSL_free(lock);
    28.           return NULL;

crypto/threads_pthread.c:27:9: 
    25.   
    26.       if (pthread_rwlock_init(lock, NULL) != 0) {
    27. >         OPENSSL_free(lock);
    28.           return NULL;
    29.       }

crypto/mem.c:289:1: start of procedure CRYPTO_free()
      287.   }
      288.   
      289. > void CRYPTO_free(void *str, const char *file, int line)
      290.   {
      291.       INCREMENT(free_count);

crypto/mem.c:292:9: Taking false branch
      290.   {
      291.       INCREMENT(free_count);
      292.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                     ^
      293.           free_impl(str, file, line);
      294.           return;

crypto/mem.c:306:5: 
      304.       }
      305.   #else
      306. >     free(str);
      307.   #endif
      308.   }

crypto/mem.c:308:1: return from a call to CRYPTO_free
      306.       free(str);
      307.   #endif
      308. > }
      309.   
      310.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/threads_pthread.c:28:9: 
    26.       if (pthread_rwlock_init(lock, NULL) != 0) {
    27.           OPENSSL_free(lock);
    28. >         return NULL;
    29.       }
    30.   # else

crypto/threads_pthread.c:49:1: return from a call to CRYPTO_THREAD_lock_new
    47.   
    48.       return lock;
    49. > }
    50.   
    51.   int CRYPTO_THREAD_read_lock(CRYPTO_RWLOCK *lock)

crypto/init.c:735:9: Taking true branch
  733.       if ((newlock = malloc(sizeof(*newlock))) == NULL)
  734.           return NULL;
  735.       if ((newlock->lock = CRYPTO_THREAD_lock_new()) == NULL) {
                 ^
  736.           free(newlock);
  737.           return NULL;

crypto/init.c:736:9: 
  734.           return NULL;
  735.       if ((newlock->lock = CRYPTO_THREAD_lock_new()) == NULL) {
  736. >         free(newlock);
  737.           return NULL;
  738.       }

crypto/init.c:737:9: 
  735.       if ((newlock->lock = CRYPTO_THREAD_lock_new()) == NULL) {
  736.           free(newlock);
  737. >         return NULL;
  738.       }
  739.       newlock->name = name;

crypto/init.c:745:1: return from a call to CRYPTO_THREAD_glock_new
  743.       CRYPTO_THREAD_unlock(glock_lock);
  744.       return newlock->lock;
  745. > }
  746.   
  747.   /*

crypto/rand/drbg_lib.c:687:9: Taking true branch
685.   
686.       drbg->lock = CRYPTO_THREAD_glock_new(name);
687.       if (drbg->lock == NULL) {
               ^
688.           RANDerr(RAND_F_DRBG_SETUP, RAND_R_FAILED_TO_CREATE_LOCK);
689.           goto err;

crypto/rand/drbg_lib.c:688:9: Skipping ERR_put_error(): empty list of specs
686.       drbg->lock = CRYPTO_THREAD_glock_new(name);
687.       if (drbg->lock == NULL) {
688.           RANDerr(RAND_F_DRBG_SETUP, RAND_R_FAILED_TO_CREATE_LOCK);
               ^
689.           goto err;
690.       }

crypto/rand/drbg_lib.c:722:1: 
720.       return drbg;
721.   
722. > err:
723.       drbg_cleanup(drbg);
724.       return NULL;

crypto/rand/drbg_lib.c:723:5: Skipping drbg_cleanup(): empty list of specs
721.   
722.   err:
723.       drbg_cleanup(drbg);
           ^
724.       return NULL;
725.   }
