test: Fix memory leak of asynctest
authorTianjia Zhang <tianjia.zhang@linux.alibaba.com>
Tue, 28 Sep 2021 15:23:44 +0000 (23:23 +0800)
committerHugo Landau <hlandau@openssl.org>
Fri, 23 Sep 2022 13:30:44 +0000 (14:30 +0100)
ASYNC_init_thread() will be called automatically by ASYNC_start_job(),
so ASYNC_cleanup_thread() must be called at last, otherwise it will
cause memory leak.

Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16703)

(cherry picked from commit c5d061290baa9466182b6d1a5b88aa9e5a4b2386)

test/asynctest.c

index 6502ee984548ec9a1321b795bf02fe0a79d82407..628d0d86ea6206deae65c6b30764b2018aee0824 100644 (file)
@@ -409,6 +409,7 @@ static int test_ASYNC_start_job_ex(void)
     ret = 1;
  err:
     ASYNC_WAIT_CTX_free(waitctx);
+    ASYNC_cleanup_thread();
     OSSL_LIB_CTX_free(libctx);
     return ret;
 }