crypto/async/async.c:331: error: USE_AFTER_FREE
  call to `async_job_free()` eventually accesses memory that was invalidated by call to `free()` on line 331 indirectly during the call to `async_job_free()`.
Showing all 20 steps of the trace


crypto/async/async.c:322:1: invalidation part of the trace starts here
320.   }
321.   
322. > static void async_empty_pool(async_pool *pool)
323.   {
324.       ASYNC_JOB *job;

crypto/async/async.c:322:1: parameter `pool` of async_empty_pool
  320.   }
  321.   
  322. > static void async_empty_pool(async_pool *pool)
  323.   {
  324.       ASYNC_JOB *job;

crypto/async/async.c:330:15: passed as argument to `sk_ASYNC_JOB_pop`
  328.   
  329.       do {
  330.           job = sk_ASYNC_JOB_pop(pool->jobs);
                       ^
  331.           async_job_free(job);
  332.       } while (job);

crypto/async/async.c:330:15: return from call to `sk_ASYNC_JOB_pop`
  328.   
  329.       do {
  330.           job = sk_ASYNC_JOB_pop(pool->jobs);
                       ^
  331.           async_job_free(job);
  332.       } while (job);

crypto/async/async.c:330:9: assigned
  328.   
  329.       do {
  330.           job = sk_ASYNC_JOB_pop(pool->jobs);
                 ^
  331.           async_job_free(job);
  332.       } while (job);

crypto/async/async.c:331:9: when calling `async_job_free` here
  329.       do {
  330.           job = sk_ASYNC_JOB_pop(pool->jobs);
  331.           async_job_free(job);
                 ^
  332.       } while (job);
  333.   }

crypto/async/async.c:139:1: parameter `job` of async_job_free
    137.   }
    138.   
    139. > static void async_job_free(ASYNC_JOB *job)
    140.   {
    141.       if (job != NULL) {

crypto/async/async.c:146:9: when calling `CRYPTO_free` here
    144.           async_close_fd(job->wait_fd);
    145.           async_close_fd(job->wake_fd);
    146.           OPENSSL_free(job);
                   ^
    147.       }
    148.   }

crypto/mem.c:234:1: parameter `str` of CRYPTO_free
      232.   }
      233.   
      234. > void CRYPTO_free(void *str)
      235.   {
      236.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG

crypto/mem.c:245:5: was invalidated by call to `free()`
      243.       }
      244.   #else
      245.       free(str);
                 ^
      246.   #endif
      247.   }

crypto/async/async.c:322:1: use-after-lifetime part of the trace starts here
320.   }
321.   
322. > static void async_empty_pool(async_pool *pool)
323.   {
324.       ASYNC_JOB *job;

crypto/async/async.c:322:1: parameter `pool` of async_empty_pool
  320.   }
  321.   
  322. > static void async_empty_pool(async_pool *pool)
  323.   {
  324.       ASYNC_JOB *job;

crypto/async/async.c:330:15: passed as argument to `sk_ASYNC_JOB_pop`
  328.   
  329.       do {
  330.           job = sk_ASYNC_JOB_pop(pool->jobs);
                       ^
  331.           async_job_free(job);
  332.       } while (job);

crypto/async/async.c:330:15: return from call to `sk_ASYNC_JOB_pop`
  328.   
  329.       do {
  330.           job = sk_ASYNC_JOB_pop(pool->jobs);
                       ^
  331.           async_job_free(job);
  332.       } while (job);

crypto/async/async.c:330:9: assigned
  328.   
  329.       do {
  330.           job = sk_ASYNC_JOB_pop(pool->jobs);
                 ^
  331.           async_job_free(job);
  332.       } while (job);

crypto/async/async.c:331:9: when calling `async_job_free` here
  329.       do {
  330.           job = sk_ASYNC_JOB_pop(pool->jobs);
  331.           async_job_free(job);
                 ^
  332.       } while (job);
  333.   }

crypto/async/async.c:139:1: parameter `job` of async_job_free
    137.   }
    138.   
    139. > static void async_job_free(ASYNC_JOB *job)
    140.   {
    141.       if (job != NULL) {

crypto/async/async.c:146:9: when calling `CRYPTO_free` here
    144.           async_close_fd(job->wait_fd);
    145.           async_close_fd(job->wake_fd);
    146.           OPENSSL_free(job);
                   ^
    147.       }
    148.   }

crypto/mem.c:234:1: parameter `str` of CRYPTO_free
      232.   }
      233.   
      234. > void CRYPTO_free(void *str)
      235.   {
      236.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG

crypto/mem.c:245:5: invalid access occurs here
      243.       }
      244.   #else
      245.       free(str);
                 ^
      246.   #endif
      247.   }

void CRYPTO_free(void *str)
{
#ifndef OPENSSL_NO_CRYPTO_MDEBUG
    if (call_malloc_debug) {
        CRYPTO_mem_debug_free(str, 0);
        free(str);
        CRYPTO_mem_debug_free(str, 1);
    } else {
        free(str);
    }
#else
    free(str);
#endif
}
['static void async_empty_pool(async_pool *pool)\n{\n    ASYNC_JOB *job;\n    if (!pool || !pool->jobs)\n        return;\n    do {\n        job = sk_ASYNC_JOB_pop(pool->jobs);\n        async_job_free(job);\n    } while (job);\n}', 'static void async_job_free(ASYNC_JOB *job)\n{\n    if (job != NULL) {\n        OPENSSL_free(job->funcargs);\n        async_fibre_free(&job->fibrectx);\n        async_close_fd(job->wait_fd);\n        async_close_fd(job->wake_fd);\n        OPENSSL_free(job);\n    }\n}', 'void CRYPTO_free(void *str)\n{\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_free(str, 0);\n        free(str);\n        CRYPTO_mem_debug_free(str, 1);\n    } else {\n        free(str);\n    }\n#else\n    free(str);\n#endif\n}']