aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2012-03-22 03:36:25 +0000
committerMichael Niedermayer <michaelni@gmx.at>2012-03-22 13:43:26 +0100
commit4246032216181c778f7ddf7f2e062cada2ef346d (patch)
treecac5ed85ace5af304f4d5c5c5325365987560e99
parentf1c69546c06d0a92057737d7a17e7aec5e875eae (diff)
downloadffmpeg-4246032216181c778f7ddf7f2e062cada2ef346d.tar.gz
segment: fix null pointer dereference
Signed-off-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/segment.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libavformat/segment.c b/libavformat/segment.c
index 1af412ad53..05f76a72c5 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -174,11 +174,13 @@ static int seg_write_header(AVFormatContext *s)
fail:
if (ret) {
- oc->streams = NULL;
- oc->nb_streams = 0;
+ if (oc) {
+ oc->streams = NULL;
+ oc->nb_streams = 0;
+ avformat_free_context(oc);
+ }
if (seg->list)
avio_close(seg->pb);
- avformat_free_context(oc);
}
return ret;
}