engines/e_dasync.c:353: error: MEMORY_LEAK
  memory dynamically allocated to `writefd` by call to `CRYPTO_malloc()` at line 311, column 19 is not reachable after line 353, column 1.
Showing all 56 steps of the trace


engines/e_dasync.c:290:1: start of procedure dummy_pause_job()
288.   #define DUMMY_CHAR 'X'
289.   
290. > static void dummy_pause_job(void) {
291.       ASYNC_JOB *job;
292.       ASYNC_WAIT_CTX *waitctx;

engines/e_dasync.c:293:5: 
291.       ASYNC_JOB *job;
292.       ASYNC_WAIT_CTX *waitctx;
293. >     OSSL_ASYNC_FD pipefds[2] = {0, 0};
294.       OSSL_ASYNC_FD *writefd;
295.   #if defined(ASYNC_WIN)

engines/e_dasync.c:299:5: 
297.       char buf = DUMMY_CHAR;
298.   #elif defined(ASYNC_POSIX)
299. >     char buf = DUMMY_CHAR;
300.   #endif
301.   

engines/e_dasync.c:302:9: 
300.   #endif
301.   
302. >     if ((job = ASYNC_get_current_job()) == NULL)
303.           return;
304.   

crypto/async/async.c:440:1: start of procedure ASYNC_get_current_job()
  438.   }
  439.   
  440. > ASYNC_JOB *ASYNC_get_current_job(void)
  441.   {
  442.       async_ctx *ctx;

crypto/async/async.c:444:5: 
  442.       async_ctx *ctx;
  443.   
  444. >     ctx = async_get_ctx();
  445.       if(ctx == NULL)
  446.           return NULL;

crypto/async/async.c:102:1: start of procedure async_get_ctx()
    100.   }
    101.   
    102. > async_ctx *async_get_ctx(void)
    103.   {
    104.       if (!OPENSSL_init_crypto(OPENSSL_INIT_ASYNC, NULL))

crypto/async/async.c:104:10: Taking false branch
    102.   async_ctx *async_get_ctx(void)
    103.   {
    104.       if (!OPENSSL_init_crypto(OPENSSL_INIT_ASYNC, NULL))
                    ^
    105.           return NULL;
    106.   

crypto/async/async.c:107:5: 
    105.           return NULL;
    106.   
    107. >     return (async_ctx *)CRYPTO_THREAD_get_local(&ctxkey);
    108.   }
    109.   

crypto/threads_pthread.c:118:1: start of procedure CRYPTO_THREAD_get_local()
      116.   }
      117.   
      118. > void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key)
      119.   {
      120.       return pthread_getspecific(*key);

crypto/threads_pthread.c:120:5: Skipping pthread_getspecific(): method has no implementation
      118.   void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key)
      119.   {
      120.       return pthread_getspecific(*key);
                 ^
      121.   }
      122.   

crypto/threads_pthread.c:121:1: return from a call to CRYPTO_THREAD_get_local
      119.   {
      120.       return pthread_getspecific(*key);
      121. > }
      122.   
      123.   int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val)

crypto/async/async.c:108:1: return from a call to async_get_ctx
    106.   
    107.       return (async_ctx *)CRYPTO_THREAD_get_local(&ctxkey);
    108. > }
    109.   
    110.   static int async_ctx_free(void)

crypto/async/async.c:445:8: Taking false branch
  443.   
  444.       ctx = async_get_ctx();
  445.       if(ctx == NULL)
                ^
  446.           return NULL;
  447.   

crypto/async/async.c:448:5: 
  446.           return NULL;
  447.   
  448. >     return ctx->currjob;
  449.   }
  450.   

crypto/async/async.c:449:1: return from a call to ASYNC_get_current_job
  447.   
  448.       return ctx->currjob;
  449. > }
  450.   
  451.   ASYNC_WAIT_CTX *ASYNC_get_wait_ctx(ASYNC_JOB *job)

engines/e_dasync.c:302:9: Taking false branch
300.   #endif
301.   
302.       if ((job = ASYNC_get_current_job()) == NULL)
               ^
303.           return;
304.   

engines/e_dasync.c:305:5: 
303.           return;
304.   
305. >     waitctx = ASYNC_get_wait_ctx(job);
306.   
307.       if (ASYNC_WAIT_CTX_get_fd(waitctx, engine_dasync_id, &pipefds[0],

crypto/async/async.c:451:1: start of procedure ASYNC_get_wait_ctx()
  449.   }
  450.   
  451. > ASYNC_WAIT_CTX *ASYNC_get_wait_ctx(ASYNC_JOB *job)
  452.   {
  453.       return job->waitctx;

crypto/async/async.c:453:5: 
  451.   ASYNC_WAIT_CTX *ASYNC_get_wait_ctx(ASYNC_JOB *job)
  452.   {
  453. >     return job->waitctx;
  454.   }
  455.   

crypto/async/async.c:454:1: return from a call to ASYNC_get_wait_ctx
  452.   {
  453.       return job->waitctx;
  454. > }
  455.   
  456.   void ASYNC_block_pause(void)

engines/e_dasync.c:307:9: 
305.       waitctx = ASYNC_get_wait_ctx(job);
306.   
307. >     if (ASYNC_WAIT_CTX_get_fd(waitctx, engine_dasync_id, &pipefds[0],
308.                                 (void **)&writefd)) {
309.           pipefds[1] = *writefd;

crypto/async/async_wait.c:106:1: start of procedure ASYNC_WAIT_CTX_get_fd()
  104.   }
  105.   
  106. > int ASYNC_WAIT_CTX_get_fd(ASYNC_WAIT_CTX *ctx, const void *key,
  107.                             OSSL_ASYNC_FD *fd, void **custom_data)
  108.   {

crypto/async/async_wait.c:111:5: 
  109.       struct fd_lookup_st *curr;
  110.   
  111. >     curr = ctx->fds;
  112.       while (curr != NULL) {
  113.           if (curr->del) {

crypto/async/async_wait.c:112:12: Loop condition is false. Leaving loop
  110.   
  111.       curr = ctx->fds;
  112.       while (curr != NULL) {
                    ^
  113.           if (curr->del) {
  114.               /* This one has been marked deleted so do nothing */

crypto/async/async_wait.c:125:5: 
  123.           curr = curr->next;
  124.       }
  125. >     return 0;
  126.   }
  127.   

crypto/async/async_wait.c:126:1: return from a call to ASYNC_WAIT_CTX_get_fd
  124.       }
  125.       return 0;
  126. > }
  127.   
  128.   int ASYNC_WAIT_CTX_get_all_fds(ASYNC_WAIT_CTX *ctx, OSSL_ASYNC_FD *fd,

engines/e_dasync.c:307:9: Taking false branch
305.       waitctx = ASYNC_get_wait_ctx(job);
306.   
307.       if (ASYNC_WAIT_CTX_get_fd(waitctx, engine_dasync_id, &pipefds[0],
               ^
308.                                 (void **)&writefd)) {
309.           pipefds[1] = *writefd;

engines/e_dasync.c:311:9: 
309.           pipefds[1] = *writefd;
310.       } else {
311. >         writefd = OPENSSL_malloc(sizeof(*writefd));
312.           if (writefd == NULL)
313.               return;

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)

engines/e_dasync.c:312:13: Taking false branch
310.       } else {
311.           writefd = OPENSSL_malloc(sizeof(*writefd));
312.           if (writefd == NULL)
                   ^
313.               return;
314.   #if defined(ASYNC_WIN)

engines/e_dasync.c:320:13: Taking false branch
318.           }
319.   #elif defined(ASYNC_POSIX)
320.           if (pipe(pipefds) != 0) {
                   ^
321.               OPENSSL_free(writefd);
322.               return;

engines/e_dasync.c:325:9: 
323.           }
324.   #endif
325. >         *writefd = pipefds[1];
326.   
327.           if(!ASYNC_WAIT_CTX_set_wait_fd(waitctx, engine_dasync_id, pipefds[0],

engines/e_dasync.c:327:13: Taking false branch
325.           *writefd = pipefds[1];
326.   
327.           if(!ASYNC_WAIT_CTX_set_wait_fd(waitctx, engine_dasync_id, pipefds[0],
                   ^
328.                                          writefd, wait_cleanup)) {
329.               wait_cleanup(waitctx, engine_dasync_id, pipefds[0], writefd);

engines/e_dasync.c:341:5: 
339.       WriteFile(pipefds[1], &buf, 1, &numwritten, NULL);
340.   #elif defined(ASYNC_POSIX)
341. >     write(pipefds[1], &buf, 1);
342.   #endif
343.   

engines/e_dasync.c:345:5: 
343.   
344.       /* Ignore errors - we carry on anyway */
345. >     ASYNC_pause_job();
346.   
347.       /* Clear the wake signal */

crypto/async/async.c:299:1: start of procedure ASYNC_pause_job()
  297.   }
  298.   
  299. > int ASYNC_pause_job(void)
  300.   {
  301.       ASYNC_JOB *job;

crypto/async/async.c:302:5: 
  300.   {
  301.       ASYNC_JOB *job;
  302. >     async_ctx *ctx = async_get_ctx();
  303.   
  304.       if (ctx == NULL

crypto/async/async.c:102:1: start of procedure async_get_ctx()
    100.   }
    101.   
    102. > async_ctx *async_get_ctx(void)
    103.   {
    104.       if (!OPENSSL_init_crypto(OPENSSL_INIT_ASYNC, NULL))

crypto/async/async.c:104:10: Taking true branch
    102.   async_ctx *async_get_ctx(void)
    103.   {
    104.       if (!OPENSSL_init_crypto(OPENSSL_INIT_ASYNC, NULL))
                    ^
    105.           return NULL;
    106.   

crypto/async/async.c:105:9: 
    103.   {
    104.       if (!OPENSSL_init_crypto(OPENSSL_INIT_ASYNC, NULL))
    105. >         return NULL;
    106.   
    107.       return (async_ctx *)CRYPTO_THREAD_get_local(&ctxkey);

crypto/async/async.c:108:1: return from a call to async_get_ctx
    106.   
    107.       return (async_ctx *)CRYPTO_THREAD_get_local(&ctxkey);
    108. > }
    109.   
    110.   static int async_ctx_free(void)

crypto/async/async.c:304:9: Taking true branch
  302.       async_ctx *ctx = async_get_ctx();
  303.   
  304.       if (ctx == NULL
                 ^
  305.               || ctx->currjob == NULL
  306.               || ctx->blocked) {

crypto/async/async.c:311:9: 
  309.            * counted as success.
  310.            */
  311. >         return 1;
  312.       }
  313.   

crypto/async/async.c:326:1: return from a call to ASYNC_pause_job
  324.   
  325.       return 1;
  326. > }
  327.   
  328.   static void async_empty_pool(async_pool *pool)

engines/e_dasync.c:351:5: 
349.       ReadFile(pipefds[0], &buf, 1, &numread, NULL);
350.   #elif defined(ASYNC_POSIX)
351. >     read(pipefds[0], &buf, 1);
352.   #endif
353.   }

engines/e_dasync.c:353:1: return from a call to dummy_pause_job
351.       read(pipefds[0], &buf, 1);
352.   #endif
353. > }
354.   
355.   /*
