crypto/rand/md_rand.c:523: error: MEMORY_LEAK
  memory dynamically allocated by call to `EVP_MD_CTX_new()` at line 326, column 9 is not reachable after line 523, column 5.
Showing all 49 steps of the trace


crypto/rand/md_rand.c:278:1: start of procedure rand_bytes()
276.   }
277.   
278. > static int rand_bytes(unsigned char *buf, int num, int pseudo)
279.   {
280.       static volatile int stirred_pool = 0;

crypto/rand/md_rand.c:280:5: 
278.   static int rand_bytes(unsigned char *buf, int num, int pseudo)
279.   {
280. >     static volatile int stirred_pool = 0;
281.       int i, j, k;
282.       size_t num_ceil, st_idx, st_num;

crypto/rand/md_rand.c:288:5: 
286.       EVP_MD_CTX *m;
287.   #ifndef GETPID_IS_MEANINGLESS
288. >     pid_t curr_pid = getpid();
289.   #endif
290.       time_t curr_time = time(NULL);

crypto/rand/md_rand.c:290:5: 
288.       pid_t curr_pid = getpid();
289.   #endif
290. >     time_t curr_time = time(NULL);
291.       int do_stir_pool = 0;
292.   /* time value for various platforms */

crypto/rand/md_rand.c:291:5: 
289.   #endif
290.       time_t curr_time = time(NULL);
291. >     int do_stir_pool = 0;
292.   /* time value for various platforms */
293.   #ifdef OPENSSL_SYS_WIN32

crypto/rand/md_rand.c:310:5: 
308.   #else
309.       struct timeval tv;
310. >     gettimeofday(&tv, NULL);
311.   #endif
312.   

crypto/rand/md_rand.c:323:9: Taking false branch
321.   #endif
322.   
323.       if (num <= 0)
               ^
324.           return 1;
325.   

crypto/rand/md_rand.c:326:5: 
324.           return 1;
325.   
326. >     m = EVP_MD_CTX_new();
327.       if (m == NULL)
328.           goto err_mem;

crypto/evp/digest.c:44:1: start of procedure EVP_MD_CTX_new()
  42.   }
  43.   
  44. > EVP_MD_CTX *EVP_MD_CTX_new(void)
  45.   {
  46.       return OPENSSL_zalloc(sizeof(EVP_MD_CTX));

crypto/evp/digest.c:46:5: 
  44.   EVP_MD_CTX *EVP_MD_CTX_new(void)
  45.   {
  46. >     return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  47.   }
  48.   

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/evp/digest.c:47:1: return from a call to EVP_MD_CTX_new
  45.   {
  46.       return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  47. > }
  48.   
  49.   void EVP_MD_CTX_free(EVP_MD_CTX *ctx)

crypto/rand/md_rand.c:327:9: Taking false branch
325.   
326.       m = EVP_MD_CTX_new();
327.       if (m == NULL)
               ^
328.           goto err_mem;
329.   

crypto/rand/md_rand.c:331:5: 
329.   
330.       /* round upwards to multiple of MD_DIGEST_LENGTH/2 */
331. >     num_ceil =
332.           (1 + (num - 1) / (MD_DIGEST_LENGTH / 2)) * (MD_DIGEST_LENGTH / 2);
333.   

crypto/rand/md_rand.c:352:10: 
350.        */
351.   
352. >     if (!RUN_ONCE(&rand_lock_init, do_rand_lock_init))
353.           goto err_mem;
354.   

crypto/threads_pthread.c:104:1: start of procedure CRYPTO_THREAD_run_once()
  102.   }
  103.   
  104. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
  105.   {
  106.       if (pthread_once(once, init) != 0)

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

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

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

crypto/rand/md_rand.c:352:10: Condition is true
350.        */
351.   
352.       if (!RUN_ONCE(&rand_lock_init, do_rand_lock_init))
                ^
353.           goto err_mem;
354.   

crypto/rand/md_rand.c:352:10: Taking true branch
350.        */
351.   
352.       if (!RUN_ONCE(&rand_lock_init, do_rand_lock_init))
                ^
353.           goto err_mem;
354.   

crypto/rand/md_rand.c:521:2: 
519.       EVP_MD_CTX_free(m);
520.       return 0;
521. >  err_mem:
522.       RANDerr(RAND_F_RAND_BYTES, ERR_R_MALLOC_FAILURE);
523.       EVP_MD_CTX_free(m);

crypto/rand/md_rand.c:522:5: Skipping ERR_put_error(): empty list of specs
520.       return 0;
521.    err_mem:
522.       RANDerr(RAND_F_RAND_BYTES, ERR_R_MALLOC_FAILURE);
           ^
523.       EVP_MD_CTX_free(m);
524.       return 0;

crypto/rand/md_rand.c:523:5: 
521.    err_mem:
522.       RANDerr(RAND_F_RAND_BYTES, ERR_R_MALLOC_FAILURE);
523. >     EVP_MD_CTX_free(m);
524.       return 0;
525.   

crypto/evp/digest.c:49:1: start of procedure EVP_MD_CTX_free()
  47.   }
  48.   
  49. > void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
  50.   {
  51.       EVP_MD_CTX_reset(ctx);

crypto/evp/digest.c:51:5: Skipping EVP_MD_CTX_reset(): empty list of specs
  49.   void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
  50.   {
  51.       EVP_MD_CTX_reset(ctx);
            ^
  52.       OPENSSL_free(ctx);
  53.   }

crypto/evp/digest.c:52:5: 
  50.   {
  51.       EVP_MD_CTX_reset(ctx);
  52. >     OPENSSL_free(ctx);
  53.   }
  54.   

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/evp/digest.c:53:1: return from a call to EVP_MD_CTX_free
  51.       EVP_MD_CTX_reset(ctx);
  52.       OPENSSL_free(ctx);
  53. > }
  54.   
  55.   int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
