From 93199473dda9106405043f3191ddfb8e9567c7e1 Mon Sep 17 00:00:00 2001 From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Date: Tue, 15 Apr 2025 00:49:22 +0200 Subject: [PATCH 06/12] textformat/tw_avio: Remove close_on_uninit param from create_file avtextwriter_create_file() creates an AVIOContext whose pointer resides in its private context. If it were not always closed on uninit, the AVIOContext would leak, so it makes no sense to have this parameter. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- fftools/ffprobe.c | 2 +- fftools/textformat/avtextwriters.h | 2 +- fftools/textformat/tw_avio.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index e0a7322523..0953a029a0 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -3161,7 +3161,7 @@ int main(int argc, char **argv) } if (output_filename) { - ret = avtextwriter_create_file(&wctx, output_filename, 1); + ret = avtextwriter_create_file(&wctx, output_filename); } else ret = avtextwriter_create_stdout(&wctx); diff --git a/fftools/textformat/avtextwriters.h b/fftools/textformat/avtextwriters.h index a62f2c8906..87b0024ba1 100644 --- a/fftools/textformat/avtextwriters.h +++ b/fftools/textformat/avtextwriters.h @@ -61,7 +61,7 @@ int avtextwriter_create_stdout(AVTextWriterContext **pwctx); int avtextwriter_create_avio(AVTextWriterContext **pwctx, AVIOContext *avio_ctx, int close_on_uninit); -int avtextwriter_create_file(AVTextWriterContext **pwctx, const char *output_filename, int close_on_uninit); +int avtextwriter_create_file(AVTextWriterContext **pwctx, const char *output_filename); int avtextwriter_create_buffer(AVTextWriterContext **pwctx, AVBPrint *buffer); diff --git a/fftools/textformat/tw_avio.c b/fftools/textformat/tw_avio.c index a80b0d2588..6034f74ec9 100644 --- a/fftools/textformat/tw_avio.c +++ b/fftools/textformat/tw_avio.c @@ -76,7 +76,7 @@ const AVTextWriter avtextwriter_avio = { .writer_w8 = io_w8 }; -int avtextwriter_create_file(AVTextWriterContext **pwctx, const char *output_filename, int close_on_uninit) +int avtextwriter_create_file(AVTextWriterContext **pwctx, const char *output_filename) { IOWriterContext *ctx; int ret; @@ -95,7 +95,7 @@ int avtextwriter_create_file(AVTextWriterContext **pwctx, const char *output_fil return ret; } - ctx->close_on_uninit = close_on_uninit; + ctx->close_on_uninit = 1; return ret; } -- 2.45.2