summaryrefslogtreecommitdiff
path: root/libavformat/rtpenc_chain.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-08-07 12:04:59 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-08-07 12:05:03 +0200
commit6bf6d6ad498d760bb60b6973789ebbf9758c999e (patch)
treeac51b4497d30034c24a49e0791662f154100282d /libavformat/rtpenc_chain.c
parent5d08f8149c113bd00c5d89b09d4cd6c2b628f335 (diff)
parent62572435d4106098c090fb8f129a9090e41ff1eb (diff)
downloadffmpeg-6bf6d6ad498d760bb60b6973789ebbf9758c999e.tar.gz
Merge commit '62572435d4106098c090fb8f129a9090e41ff1eb'
* commit '62572435d4106098c090fb8f129a9090e41ff1eb': rtpenc_chain: Check for errors from ffio_fdopen and ffio_open_dyn_packet_buf Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/rtpenc_chain.c')
-rw-r--r--libavformat/rtpenc_chain.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/libavformat/rtpenc_chain.c b/libavformat/rtpenc_chain.c
index 70d68ce534..9379d94697 100644
--- a/libavformat/rtpenc_chain.c
+++ b/libavformat/rtpenc_chain.c
@@ -78,16 +78,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);