aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-03-02 16:41:31 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-03-03 09:20:36 +0100
commit1a4e0eb3745488e9756495357c6829ecdc45b076 (patch)
tree0041d33803e3222527673a65b9275daf9b72f77e
parent77b26bf4b63b186cf1ea040d1a0ffa593b6ae700 (diff)
downloadffmpeg-1a4e0eb3745488e9756495357c6829ecdc45b076.tar.gz
avformat/dvdvideodec: Reorder allocations to simplify freeing
Reviewed-by: Marth64 <marth64@proxyid.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r--libavformat/dvdvideodec.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/libavformat/dvdvideodec.c b/libavformat/dvdvideodec.c
index f2f23affb2..7f4ecf2b61 100644
--- a/libavformat/dvdvideodec.c
+++ b/libavformat/dvdvideodec.c
@@ -1211,20 +1211,16 @@ static int dvdvideo_subdemux_open(AVFormatContext *s)
extern const AVInputFormat ff_mpegps_demuxer;
int ret = 0;
- if (!(c->mpeg_ctx = avformat_alloc_context()))
- return AVERROR(ENOMEM);
-
- if (!(c->mpeg_buf = av_mallocz(DVDVIDEO_BLOCK_SIZE))) {
- avformat_free_context(c->mpeg_ctx);
- c->mpeg_ctx = NULL;
-
+ if (!(c->mpeg_buf = av_mallocz(DVDVIDEO_BLOCK_SIZE)))
return AVERROR(ENOMEM);
- }
ffio_init_context(&c->mpeg_pb, c->mpeg_buf, DVDVIDEO_BLOCK_SIZE, 0, s,
dvdvideo_subdemux_read_data, NULL, NULL);
c->mpeg_pb.pub.seekable = 0;
+ if (!(c->mpeg_ctx = avformat_alloc_context()))
+ return AVERROR(ENOMEM);
+
if ((ret = ff_copy_whiteblacklists(c->mpeg_ctx, s)) < 0) {
avformat_free_context(c->mpeg_ctx);
c->mpeg_ctx = NULL;