segment: fix null pointer dereference

Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Paul B Mahol 2012-03-22 03:36:25 +00:00 committed by Michael Niedermayer
parent f1c69546c0
commit 4246032216
1 changed files with 5 additions and 3 deletions

View File

@ -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;
}