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


crypto/rand/ossl_rand.c:251:1: start of procedure rand_bytes()
249.   }
250.   
251. > static int rand_bytes(unsigned char *buf, int num)
252.   {
253.       static volatile int stirred_pool = 0;

crypto/rand/ossl_rand.c:253:5: 
251.   static int rand_bytes(unsigned char *buf, int num)
252.   {
253. >     static volatile int stirred_pool = 0;
254.       int i, j, k;
255.       size_t num_ceil, st_idx, st_num;

crypto/rand/ossl_rand.c:260:5: 
258.       unsigned char local_md[SHA_DIGEST_LENGTH];
259.       EVP_MD_CTX *m;
260. >     OSSL_RAND_STATE *sp = &global_state;
261.   #ifndef GETPID_IS_MEANINGLESS
262.       pid_t curr_pid = getpid();

crypto/rand/ossl_rand.c:262:5: 
260.       OSSL_RAND_STATE *sp = &global_state;
261.   #ifndef GETPID_IS_MEANINGLESS
262. >     pid_t curr_pid = getpid();
263.   #endif
264.       time_t curr_time = time(NULL);

crypto/rand/ossl_rand.c:264:5: 
262.       pid_t curr_pid = getpid();
263.   #endif
264. >     time_t curr_time = time(NULL);
265.       int do_stir_pool = 0;
266.   /* time value for various platforms */

crypto/rand/ossl_rand.c:265:5: 
263.   #endif
264.       time_t curr_time = time(NULL);
265. >     int do_stir_pool = 0;
266.   /* time value for various platforms */
267.   #ifdef OPENSSL_SYS_WIN32

crypto/rand/ossl_rand.c:284:5: 
282.   #else
283.       struct timeval tv;
284. >     gettimeofday(&tv, NULL);
285.   #endif
286.   

crypto/rand/ossl_rand.c:287:9: Taking false branch
285.   #endif
286.   
287.       if (num <= 0)
               ^
288.           return 1;
289.   

crypto/rand/ossl_rand.c:290:5: 
288.           return 1;
289.   
290. >     m = EVP_MD_CTX_new();
291.       if (m == NULL)
292.           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:197:1: start of procedure CRYPTO_zalloc()
    195.   }
    196.   
    197. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    198.   {
    199.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:199:5: 
    197.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    198.   {
    199. >     void *ret = CRYPTO_malloc(num, file, line);
    200.   
    201.       FAILTEST();

crypto/mem.c:169:1: start of procedure CRYPTO_malloc()
      167.   #endif
      168.   
      169. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      170.   {
      171.       void *ret = NULL;

crypto/mem.c:171:5: 
      169.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      170.   {
      171. >     void *ret = NULL;
      172.   
      173.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:173:9: Taking false branch
      171.       void *ret = NULL;
      172.   
      173.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                     ^
      174.           return malloc_impl(num, file, line);
      175.   

crypto/mem.c:176:9: Taking false branch
      174.           return malloc_impl(num, file, line);
      175.   
      176.       if (num == 0)
                     ^
      177.           return NULL;
      178.   

crypto/mem.c:180:5: 
      178.   
      179.       FAILTEST();
      180. >     allow_customize = 0;
      181.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      182.       if (call_malloc_debug) {

crypto/mem.c:190:5: 
      188.       }
      189.   #else
      190. >     osslargused(file); osslargused(line);
      191.       ret = malloc(num);
      192.   #endif

crypto/mem.c:190:24: 
      188.       }
      189.   #else
      190. >     osslargused(file); osslargused(line);
      191.       ret = malloc(num);
      192.   #endif

crypto/mem.c:191:5: 
      189.   #else
      190.       osslargused(file); osslargused(line);
      191. >     ret = malloc(num);
      192.   #endif
      193.   

crypto/mem.c:194:5: 
      192.   #endif
      193.   
      194. >     return ret;
      195.   }
      196.   

crypto/mem.c:195:1: return from a call to CRYPTO_malloc
      193.   
      194.       return ret;
      195. > }
      196.   
      197.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:202:9: Taking true branch
    200.   
    201.       FAILTEST();
    202.       if (ret != NULL)
                   ^
    203.           memset(ret, 0, num);
    204.       return ret;

crypto/mem.c:203:9: 
    201.       FAILTEST();
    202.       if (ret != NULL)
    203. >         memset(ret, 0, num);
    204.       return ret;
    205.   }

crypto/mem.c:204:5: 
    202.       if (ret != NULL)
    203.           memset(ret, 0, num);
    204. >     return ret;
    205.   }
    206.   

crypto/mem.c:205:1: return from a call to CRYPTO_zalloc
    203.           memset(ret, 0, num);
    204.       return ret;
    205. > }
    206.   
    207.   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/ossl_rand.c:291:9: Taking false branch
289.   
290.       m = EVP_MD_CTX_new();
291.       if (m == NULL)
               ^
292.           goto err_mem;
293.   

crypto/rand/ossl_rand.c:295:5: 
293.   
294.       /* round upwards to multiple of SHA_DIGEST_LENGTH/2 */
295. >     num_ceil =
296.           (1 + (num - 1) / (SHA_DIGEST_LENGTH / 2)) * (SHA_DIGEST_LENGTH / 2);
297.   

crypto/rand/ossl_rand.c:316:10: 
314.        */
315.   
316. >     if (!RUN_ONCE(&ossl_rand_init, do_ossl_rand_init))
317.           goto err_mem;
318.   

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/rand/ossl_rand.c:316:10: Condition is true
314.        */
315.   
316.       if (!RUN_ONCE(&ossl_rand_init, do_ossl_rand_init))
                ^
317.           goto err_mem;
318.   

crypto/rand/ossl_rand.c:316:10: Taking true branch
314.        */
315.   
316.       if (!RUN_ONCE(&ossl_rand_init, do_ossl_rand_init))
                ^
317.           goto err_mem;
318.   

crypto/rand/ossl_rand.c:483:2: 
481.       EVP_MD_CTX_free(m);
482.       return 0;
483. >  err_mem:
484.       RANDerr(RAND_F_RAND_BYTES, ERR_R_MALLOC_FAILURE);
485.       EVP_MD_CTX_free(m);

crypto/rand/ossl_rand.c:484:5: Skipping ERR_put_error(): empty list of specs
482.       return 0;
483.    err_mem:
484.       RANDerr(RAND_F_RAND_BYTES, ERR_R_MALLOC_FAILURE);
           ^
485.       EVP_MD_CTX_free(m);
486.       return 0;

crypto/rand/ossl_rand.c:485:5: 
483.    err_mem:
484.       RANDerr(RAND_F_RAND_BYTES, ERR_R_MALLOC_FAILURE);
485. >     EVP_MD_CTX_free(m);
486.       return 0;
487.   

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:264:1: start of procedure CRYPTO_free()
    262.   }
    263.   
    264. > void CRYPTO_free(void *str, const char *file, int line)
    265.   {
    266.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:266:9: Taking true branch
    264.   void CRYPTO_free(void *str, const char *file, int line)
    265.   {
    266.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    267.           free_impl(str, file, line);
    268.           return;

crypto/mem.c:266:30: Taking true branch
    264.   void CRYPTO_free(void *str, const char *file, int line)
    265.   {
    266.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    267.           free_impl(str, file, line);
    268.           return;

crypto/mem.c:267:9: Skipping __function_pointer__(): unresolved function pointer
    265.   {
    266.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    267.           free_impl(str, file, line);
                   ^
    268.           return;
    269.       }

crypto/mem.c:268:9: 
    266.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    267.           free_impl(str, file, line);
    268. >         return;
    269.       }
    270.   

crypto/mem.c:282:1: return from a call to CRYPTO_free
    280.       free(str);
    281.   #endif
    282. > }
    283.   
    284.   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)
