summaryrefslogtreecommitdiff
path: root/libavformat/mov.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-01-22 05:15:47 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-01-22 05:15:47 +0100
commit0a84174f2d41757bcefdc87e9dfb26a7016ab62f (patch)
tree5240cc9afaf3d5901436133e9ca2a6fe87572fa4 /libavformat/mov.c
parentb3ab2810277decc2c0bfbaa08414a432e4774f34 (diff)
mov: prevent double free if the caller replaces the io context.
Fixes Ticket2148 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r--libavformat/mov.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 6c78adbd2a..7f7c0e13d8 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2230,8 +2230,10 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom)
"filename='%s', volume='%s', nlvl_from=%d, nlvl_to=%d\n",
st->index, dref->path, dref->dir, dref->filename,
dref->volume, dref->nlvl_from, dref->nlvl_to);
- } else
+ } else {
sc->pb = c->fc->pb;
+ sc->pb_is_copied = 1;
+ }
if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
if (!st->sample_aspect_ratio.num &&
@@ -3071,7 +3073,7 @@ static int mov_read_close(AVFormatContext *s)
av_freep(&sc->drefs[j].dir);
}
av_freep(&sc->drefs);
- if (sc->pb && sc->pb != s->pb)
+ if (!sc->pb_is_copied)
avio_close(sc->pb);
sc->pb = NULL;
av_freep(&sc->chunk_offsets);