free Track and unset priv_data to avoid double free, fix memleak

Originally committed as revision 18836 to svn://svn.ffmpeg.org/ffmpeg/trunk
release/0.6
Baptiste Coudurier 16 years ago
parent df099252bb
commit 8be080aebb
  1. 7
      libavformat/mxfdec.c

@ -943,6 +943,10 @@ static int mxf_read_close(AVFormatContext *s)
int i; int i;
av_freep(&mxf->packages_refs); av_freep(&mxf->packages_refs);
for (i = 0; i < s->nb_streams; i++)
s->streams[i]->priv_data = NULL;
for (i = 0; i < mxf->metadata_sets_count; i++) { for (i = 0; i < mxf->metadata_sets_count; i++) {
switch (mxf->metadata_sets[i]->type) { switch (mxf->metadata_sets[i]->type) {
case MultipleDescriptor: case MultipleDescriptor:
@ -955,9 +959,6 @@ static int mxf_read_close(AVFormatContext *s)
case MaterialPackage: case MaterialPackage:
av_freep(&((MXFPackage *)mxf->metadata_sets[i])->tracks_refs); av_freep(&((MXFPackage *)mxf->metadata_sets[i])->tracks_refs);
break; break;
case Track:
mxf->metadata_sets[i] = NULL; /* will be freed later */
break;
default: default:
break; break;
} }

Loading…
Cancel
Save