This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit adf2d4e90f7638694bf99b18bc00588a6c49041d Author: Niklas Haas <[email protected]> AuthorDate: Fri Mar 6 20:27:37 2026 +0100 Commit: Niklas Haas <[email protected]> CommitDate: Thu Mar 12 21:02:48 2026 +0000 swscale/ops_dispatch: add helper function to clean up SwsCompiledOp Sponsored-by: Sovereign Tech Fund Signed-off-by: Niklas Haas <[email protected]> --- libswscale/ops_dispatch.c | 12 +++++++++--- libswscale/ops_dispatch.h | 2 ++ tests/checkasm/sw_ops.c | 7 +++---- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/libswscale/ops_dispatch.c b/libswscale/ops_dispatch.c index 655b26cac9..1c3d3239f6 100644 --- a/libswscale/ops_dispatch.c +++ b/libswscale/ops_dispatch.c @@ -95,15 +95,21 @@ int ff_sws_ops_compile(SwsContext *ctx, const SwsOpList *ops, SwsCompiledOp *out return AVERROR(ENOTSUP); } +void ff_sws_compiled_op_unref(SwsCompiledOp *comp) +{ + if (comp->free) + comp->free(comp->priv); + + *comp = (SwsCompiledOp) {0}; +} + static void op_pass_free(void *ptr) { SwsOpPass *p = ptr; if (!p) return; - if (p->comp.free) - p->comp.free(p->comp.priv); - + ff_sws_compiled_op_unref(&p->comp); av_free(p); } diff --git a/libswscale/ops_dispatch.h b/libswscale/ops_dispatch.h index ebbd1f68e7..ca99457e28 100644 --- a/libswscale/ops_dispatch.h +++ b/libswscale/ops_dispatch.h @@ -100,4 +100,6 @@ typedef struct SwsCompiledOp { void (*free)(void *priv); } SwsCompiledOp; +void ff_sws_compiled_op_unref(SwsCompiledOp *comp); + #endif /* SWSCALE_OPS_DISPATCH_H */ diff --git a/tests/checkasm/sw_ops.c b/tests/checkasm/sw_ops.c index 6c509567eb..b20a7559f1 100644 --- a/tests/checkasm/sw_ops.c +++ b/tests/checkasm/sw_ops.c @@ -241,10 +241,9 @@ static void check_ops(const char *report, const unsigned ranges[NB_PLANES], bench(comp_new.func, &exec, comp_new.priv, 0, 0, PIXELS / comp_new.block_size, LINES); } - if (comp_new.func != comp_ref.func && comp_new.free) - comp_new.free(comp_new.priv); - if (comp_ref.free) - comp_ref.free(comp_ref.priv); + if (comp_new.func != comp_ref.func) + ff_sws_compiled_op_unref(&comp_new); + ff_sws_compiled_op_unref(&comp_ref); sws_free_context(&ctx); } _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
