diff options
author | Martin Storsjö <martin@martin.st> | 2013-10-03 12:27:10 +0200 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2013-10-04 09:25:06 +0300 |
commit | 72540e514ceaaed8ecb97ed63637b2a2a4447ab8 (patch) | |
tree | cc18b6ac41b96cb96bdbfa013253d6e8fb2dfb7e /libavformat/rtmpproto.c | |
parent | 4d6d70292e91a7ef027824d731b6b6570ceabf2f (diff) | |
download | ffmpeg-72540e514ceaaed8ecb97ed63637b2a2a4447ab8.tar.gz |
rtmpproto: Clear the flv allocation size on reallocp failures
This was overlooked in d872fb0f7 since I assumed all the realloc
issues in the rtmp code was fixed already.
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat/rtmpproto.c')
-rw-r--r-- | libavformat/rtmpproto.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index 02fbcc420f..21d7ad80f6 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -2098,8 +2098,10 @@ static int append_flv_data(RTMPContext *rt, RTMPPacket *pkt, int skip) old_flv_size = update_offset(rt, size); - if ((ret = av_reallocp(&rt->flv_data, rt->flv_size)) < 0) + if ((ret = av_reallocp(&rt->flv_data, rt->flv_size)) < 0) { + rt->flv_size = rt->flv_off = 0; return ret; + } bytestream2_init_writer(&pbc, rt->flv_data, rt->flv_size); bytestream2_skip_p(&pbc, old_flv_size); bytestream2_put_byte(&pbc, pkt->type); @@ -2199,8 +2201,10 @@ static int handle_metadata(RTMPContext *rt, RTMPPacket *pkt) old_flv_size = update_offset(rt, pkt->size); - if ((ret = av_reallocp(&rt->flv_data, rt->flv_size)) < 0) + if ((ret = av_reallocp(&rt->flv_data, rt->flv_size)) < 0) { + rt->flv_size = rt->flv_off = 0; return ret; + } next = pkt->data; p = rt->flv_data + old_flv_size; |