diff options
author | Martin Storsjö <martin@martin.st> | 2013-08-07 10:07:48 +0300 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2013-08-07 11:37:01 +0300 |
commit | f542dedf72091af8e6f32a12bd64289c58857c21 (patch) | |
tree | ff1bb3159679191da14d842320095de34cfc5359 /libavformat | |
parent | 1c6d2bb9a9279d8df4e8bcdc1e1e2741723dc7c9 (diff) | |
download | ffmpeg-f542dedf72091af8e6f32a12bd64289c58857c21.tar.gz |
rtspenc: Check the return value from ffio_open_dyn_packet_buf
Also clear the AVIOContext handle after freeing, to avoid
possible dangling pointers if the later call fails.
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/rtspenc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libavformat/rtspenc.c b/libavformat/rtspenc.c index 9b3c7c937e..d8e5b0e212 100644 --- a/libavformat/rtspenc.c +++ b/libavformat/rtspenc.c @@ -145,6 +145,7 @@ static int tcp_write_packet(AVFormatContext *s, RTSPStream *rtsp_st) uint8_t *interleave_header, *interleaved_packet; size = avio_close_dyn_buf(rtpctx->pb, &buf); + rtpctx->pb = NULL; ptr = buf; while (size > 4) { uint32_t packet_len = AV_RB32(ptr); @@ -171,8 +172,7 @@ static int tcp_write_packet(AVFormatContext *s, RTSPStream *rtsp_st) size -= packet_len; } av_free(buf); - ffio_open_dyn_packet_buf(&rtpctx->pb, RTSP_TCP_MAX_PACKET_SIZE); - return 0; + return ffio_open_dyn_packet_buf(&rtpctx->pb, RTSP_TCP_MAX_PACKET_SIZE); } static int rtsp_write_packet(AVFormatContext *s, AVPacket *pkt) |