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


crypto/rand/drbg_lib.c:651:1: start of procedure drbg_setup()
649.    * Returns a pointer to the new DRBG instance on success, NULL on failure.
650.    */
651. > static RAND_DRBG *drbg_setup(const char *name, RAND_DRBG *parent)
652.   {
653.       RAND_DRBG *drbg;

crypto/rand/drbg_lib.c:655:9: Taking false branch
653.       RAND_DRBG *drbg;
654.   
655.       if (name == NULL) {
               ^
656.           RANDerr(RAND_F_DRBG_SETUP, ERR_R_INTERNAL_ERROR);
657.           return NULL;

crypto/rand/drbg_lib.c:660:5: 
658.       }
659.   
660. >     drbg = OPENSSL_secure_zalloc(sizeof(RAND_DRBG));
661.       if (drbg == NULL)
662.           return NULL;

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

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

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

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

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

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

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

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

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

crypto/mem.c:201:5: 
      199.   
      200.       FAILTEST();
      201. >     allow_customize = 0;
      202.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      203.       if (call_malloc_debug) {

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

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

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

crypto/mem.c:215:5: 
      213.   #endif
      214.   
      215. >     return ret;
      216.   }
      217.   

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

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

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

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

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

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

crypto/rand/drbg_lib.c:661:9: Taking false branch
659.   
660.       drbg = OPENSSL_secure_zalloc(sizeof(RAND_DRBG));
661.       if (drbg == NULL)
               ^
662.           return NULL;
663.   

crypto/rand/drbg_lib.c:664:5: 
662.           return NULL;
663.   
664. >     drbg->lock = CRYPTO_THREAD_glock_new(name);
665.       if (drbg->lock == NULL) {
666.           RANDerr(RAND_F_DRBG_SETUP, RAND_R_FAILED_TO_CREATE_LOCK);

crypto/init.c:727:1: start of procedure CRYPTO_THREAD_glock_new()
  725.    * Create a new global lock, return NULL on error.
  726.    */
  727. > CRYPTO_RWLOCK *CRYPTO_THREAD_glock_new(const char *name)
  728.   {
  729.       GLOBAL_LOCK *newlock;

crypto/init.c:731:9: Taking true 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:731:32: 
  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/threads_pthread.c:105:1: start of procedure CRYPTO_THREAD_run_once()
    103.   }
    104.   
    105. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
    106.   {
    107.       if (pthread_once(once, init) != 0)

crypto/threads_pthread.c:107:9: Taking false branch
    105.   int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
    106.   {
    107.       if (pthread_once(once, init) != 0)
                   ^
    108.           return 0;
    109.   

crypto/threads_pthread.c:110:5: 
    108.           return 0;
    109.   
    110. >     return 1;
    111.   }
    112.   

crypto/threads_pthread.c:111:1: return from a call to CRYPTO_THREAD_run_once
    109.   
    110.       return 1;
    111. > }
    112.   
    113.   int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *))

crypto/init.c:731:32: Condition is true
  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:731:32: 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:218:1: start of procedure CRYPTO_zalloc()
      216.   }
      217.   
      218. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
      219.   {
      220.       void *ret = CRYPTO_malloc(num, file, line);

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

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

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

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

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

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

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

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

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

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

crypto/mem.c:226:1: return from a call to CRYPTO_zalloc
      224.           memset(ret, 0, num);
      225.       return ret;
      226. > }
      227.   
      228.   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:286:1: start of procedure CRYPTO_free()
      284.   }
      285.   
      286. > void CRYPTO_free(void *str, const char *file, int line)
      287.   {
      288.       INCREMENT(free_count);

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

crypto/mem.c:303:5: 
      301.       }
      302.   #else
      303. >     free(str);
      304.   #endif
      305.   }

crypto/mem.c:305:1: return from a call to CRYPTO_free
      303.       free(str);
      304.   #endif
      305. > }
      306.   
      307.   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:665:9: Taking true branch
663.   
664.       drbg->lock = CRYPTO_THREAD_glock_new(name);
665.       if (drbg->lock == NULL) {
               ^
666.           RANDerr(RAND_F_DRBG_SETUP, RAND_R_FAILED_TO_CREATE_LOCK);
667.           goto err;

crypto/rand/drbg_lib.c:666:9: Skipping ERR_put_error(): empty list of specs
664.       drbg->lock = CRYPTO_THREAD_glock_new(name);
665.       if (drbg->lock == NULL) {
666.           RANDerr(RAND_F_DRBG_SETUP, RAND_R_FAILED_TO_CREATE_LOCK);
               ^
667.           goto err;
668.       }

crypto/rand/drbg_lib.c:700:1: 
698.       return drbg;
699.   
700. > err:
701.       drbg_cleanup(drbg);
702.       return NULL;

crypto/rand/drbg_lib.c:701:5: Skipping drbg_cleanup(): empty list of specs
699.   
700.   err:
701.       drbg_cleanup(drbg);
           ^
702.       return NULL;
703.   }
