diff mbox series

[FFmpeg-devel,11/33] fftools/ffmpeg_mux_init: move allocation out of prologue

Message ID 20230713105553.21052-11-anton@khirnov.net
State Accepted
Commit 38a2fc2c291efd3f0e09941c5c0a43805a9b2cd2
Headers show
Series [FFmpeg-devel,01/33] fftools/ffmpeg_mux_init: return errors from of_open() instead of aborting | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Anton Khirnov July 13, 2023, 10:55 a.m. UTC
ost_add() has a very large variable declaration prologue, performing
"active" actions that can fail in there is confusing.
---
 fftools/ffmpeg_mux_init.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index 8e640610cd..bd4c0a9f97 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -987,13 +987,14 @@  static OutputStream *ost_add(Muxer *mux, const OptionsContext *o,
     MuxStream     *ms;
     OutputStream *ost;
     const AVCodec *enc;
-    AVStream *st = avformat_new_stream(oc, NULL);
+    AVStream *st;
     int ret = 0;
     const char *bsfs = NULL, *time_base = NULL;
     char *filters = NULL, *next, *codec_tag = NULL;
     double qscale = -1;
     int i;
 
+    st = avformat_new_stream(oc, NULL);
     if (!st)
         report_and_exit(AVERROR(ENOMEM));