aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2011-06-05 13:18:17 +0200
committerAnton Khirnov <anton@khirnov.net>2011-06-05 15:01:36 +0200
commit367732832faaf1bac4ece37cf7fef8c911e16312 (patch)
tree3e3cf5d1809f898f9f25dca63b2e2f8117424bde /libavformat
parentb39b06233dfd69b941a32f29171dfb63abb23c06 (diff)
downloadffmpeg-367732832faaf1bac4ece37cf7fef8c911e16312.tar.gz
lavf,lavc: free avoptions in a generic way.
It's simpler and less error-prone. Fixes some memleaks along the way.
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/rawdec.c4
-rw-r--r--libavformat/tty.c1
-rw-r--r--libavformat/utils.c7
3 files changed, 6 insertions, 6 deletions
diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c
index a92200d844..cc05c353e9 100644
--- a/libavformat/rawdec.c
+++ b/libavformat/rawdec.c
@@ -102,9 +102,6 @@ int ff_raw_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->height = height;
st->codec->pix_fmt = pix_fmt;
fail:
- av_freep(&s1->video_size);
- av_freep(&s1->pixel_format);
- av_freep(&s1->framerate);
return ret;
}
default:
@@ -182,7 +179,6 @@ int ff_raw_video_read_header(AVFormatContext *s,
av_set_pts_info(st, 64, 1, 1200000);
fail:
- av_freep(&s1->framerate);
return ret;
}
diff --git a/libavformat/tty.c b/libavformat/tty.c
index 9dada16b8a..970274eb54 100644
--- a/libavformat/tty.c
+++ b/libavformat/tty.c
@@ -121,7 +121,6 @@ static int read_header(AVFormatContext *avctx,
}
fail:
- av_freep(&s->video_size);
return ret;
}
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 1050959dcb..bdc20f6d9b 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2549,6 +2549,10 @@ void avformat_free_context(AVFormatContext *s)
int i;
AVStream *st;
+ av_opt_free(s);
+ if (s->iformat && s->iformat->priv_class)
+ av_opt_free(s->priv_data);
+
for(i=0;i<s->nb_streams;i++) {
/* free all data in a stream component */
st = s->streams[i];
@@ -2578,7 +2582,6 @@ void avformat_free_context(AVFormatContext *s)
}
av_freep(&s->chapters);
av_metadata_free(&s->metadata);
- av_freep(&s->key);
av_freep(&s->streams);
av_free(s);
}
@@ -3094,6 +3097,8 @@ fail:
av_freep(&s->streams[i]->priv_data);
av_freep(&s->streams[i]->index_entries);
}
+ if (s->iformat && s->iformat->priv_class)
+ av_opt_free(s->priv_data);
av_freep(&s->priv_data);
return ret;
}