diff options
author | Martin Storsjö <martin@martin.st> | 2013-08-07 10:20:07 +0300 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2013-08-07 11:37:13 +0300 |
commit | 62572435d4106098c090fb8f129a9090e41ff1eb (patch) | |
tree | 55523b308298de9aef503e3f4090110fc02735d4 | |
parent | f542dedf72091af8e6f32a12bd64289c58857c21 (diff) | |
download | ffmpeg-62572435d4106098c090fb8f129a9090e41ff1eb.tar.gz |
rtpenc_chain: Check for errors from ffio_fdopen and ffio_open_dyn_packet_buf
Signed-off-by: Martin Storsjö <martin@martin.st>
-rw-r--r-- | libavformat/rtpenc_chain.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/libavformat/rtpenc_chain.c b/libavformat/rtpenc_chain.c index 935dd6cd31..10c4020cfe 100644 --- a/libavformat/rtpenc_chain.c +++ b/libavformat/rtpenc_chain.c @@ -75,16 +75,19 @@ int ff_rtp_chain_mux_open(AVFormatContext **out, AVFormatContext *s, avcodec_copy_context(rtpctx->streams[0]->codec, st->codec); if (handle) { - ffio_fdopen(&rtpctx->pb, handle); + ret = ffio_fdopen(&rtpctx->pb, handle); + if (ret < 0) + ffurl_close(handle); } else - ffio_open_dyn_packet_buf(&rtpctx->pb, packet_size); - ret = avformat_write_header(rtpctx, &opts); + ret = ffio_open_dyn_packet_buf(&rtpctx->pb, packet_size); + if (!ret) + ret = avformat_write_header(rtpctx, &opts); av_dict_free(&opts); if (ret) { - if (handle) { + if (handle && rtpctx->pb) { avio_close(rtpctx->pb); - } else { + } else if (rtpctx->pb) { uint8_t *ptr; avio_close_dyn_buf(rtpctx->pb, &ptr); av_free(ptr); |