This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit c4a74c53c3205026a24f360213d181f3502e9c12 Author: Andreas Rheinhardt <[email protected]> AuthorDate: Thu Aug 6 03:55:12 2026 +0200 Commit: Andreas Rheinhardt <[email protected]> CommitDate: Sun Aug 9 16:29:56 2026 +0200 tests/checkasm/crc: Free allocations The CRC test uses a linked list of containing the CRC tables of already tested instruction sets; the head of the list is in static storage and up until now was never freed (i.e. reported as "still reachable" by Valgrind). Free it properly by adding an uninit callback. Signed-off-by: Andreas Rheinhardt <[email protected]> --- tests/checkasm/checkasm.c | 2 +- tests/checkasm/checkasm.h | 1 + tests/checkasm/crc.c | 30 +++++++++++++++++++++--------- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index d394d3c61a..cce47ecafb 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -300,7 +300,7 @@ static const CheckasmTest tests[] = { #endif #if CONFIG_AVUTIL { "aes", checkasm_check_aes }, - { "crc", checkasm_check_crc }, + { "crc", checkasm_check_crc, .uninit = checkasm_uninit_crc }, { "fixed_dsp", checkasm_check_fixed_dsp }, { "float_dsp", checkasm_check_float_dsp }, { "lls", checkasm_check_lls }, diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h index 221c0e220a..a6e47d8b85 100644 --- a/tests/checkasm/checkasm.h +++ b/tests/checkasm/checkasm.h @@ -128,6 +128,7 @@ void checkasm_check_vvc_alf(void); void checkasm_check_vvc_mc(void); void checkasm_check_vvc_sao(void); +void checkasm_uninit_crc(void); void checkasm_uninit_tx(void); #define rnd checkasm_rand_uint32 diff --git a/tests/checkasm/crc.c b/tests/checkasm/crc.c index 345ea26546..8c133e1730 100644 --- a/tests/checkasm/crc.c +++ b/tests/checkasm/crc.c @@ -34,6 +34,22 @@ #include "libavutil/mem.h" #include "libavutil/mem_internal.h" +typedef struct CustomTest { + struct CustomTest *prev; + AVCRC ctx[1024]; +} CustomTest; + +static CustomTest *ctx_list = NULL; + +void checkasm_uninit_crc(void) +{ + for (CustomTest *cur = ctx_list; cur;) { + CustomTest *prev = cur->prev; + av_free(cur); + cur = prev; + } + ctx_list = NULL; +} static void check_crc(const AVCRC *table_new, const char *name, unsigned idx) { @@ -84,10 +100,6 @@ void checkasm_check_crc(void) for (unsigned i = 0; i < AV_CRC_MAX; ++i) check_crc(av_crc_get_table(i), tests[i], i); - static struct CustomTest { - struct CustomTest *prev; - AVCRC ctx[1024]; - } *ctx = NULL; struct CustomTest *new = av_mallocz(sizeof(*new)); static int le, bits; static uint32_t poly; @@ -95,19 +107,19 @@ void checkasm_check_crc(void) if (!new) fail(); - if (!ctx) { + if (!ctx_list) { le = rnd() & 1; bits = 8 + rnd() % 25; // av_crc_init() accepts between 8 and 32 bits poly = rnd() >> (32 - bits); } av_assert0(av_crc_init(new->ctx, le, bits, poly, sizeof(new->ctx)) >= 0); - if (ctx && !memcmp(ctx->ctx, new->ctx, sizeof(new->ctx))) { + if (ctx_list && !memcmp(ctx_list->ctx, new->ctx, sizeof(new->ctx))) { av_free(new); } else { - new->prev = ctx; - ctx = new; + new->prev = ctx_list; + ctx_list = new; } - check_crc(ctx->ctx, "custom_polynomial", AV_CRC_MAX); + check_crc(ctx_list->ctx, "custom_polynomial", AV_CRC_MAX); report("crc"); } _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
