summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-03-27 04:42:15 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-04-05 18:06:50 +0200
commit7940655d14e1741d68c364a8d027152f4f3420eb (patch)
tree2ee26c3544e7ff5be2d8cd7b2e21e51718b4db71 /libavformat
parent559c2e96e371f30eedccf370d4606fc86706ab75 (diff)
avformat/avidec: Don't reimplement ff_free_stream()
Using ff_free_stream() makes the code more readable, more future-proof (the old code freed AVCodecContexts and AVCodecParameters and its substructures manually, so that there is a chance that there would be a memleak for some time if new substructures were added) and reduces code size. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/avidec.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 00c3978b2d..ae343e732a 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -600,21 +600,8 @@ static int avi_read_header(AVFormatContext *s)
goto fail;
ast = s->streams[0]->priv_data;
- av_freep(&s->streams[0]->codecpar->extradata);
- av_freep(&s->streams[0]->codecpar);
-#if FF_API_LAVF_AVCTX
-FF_DISABLE_DEPRECATION_WARNINGS
- av_freep(&s->streams[0]->codec);
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
- if (s->streams[0]->info)
- av_freep(&s->streams[0]->info->duration_error);
- av_freep(&s->streams[0]->info);
- if (s->streams[0]->internal)
- av_freep(&s->streams[0]->internal->avctx);
- av_freep(&s->streams[0]->internal);
- av_freep(&s->streams[0]);
- s->nb_streams = 0;
+ st->priv_data = NULL;
+ ff_free_stream(s, st);
if (CONFIG_DV_DEMUXER) {
avi->dv_demux = avpriv_dv_init_demux(s);
if (!avi->dv_demux)