From d872fb0f7ff2ff0ba87f5ccf6a1a55ca2be472c9 Mon Sep 17 00:00:00 2001 From: Martin Storsjö Date: Thu, 26 Sep 2013 16:37:02 +0300 Subject: lavf: Reset the entry count and allocation size variables on av_reallocp failures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When av_reallocp fails, the associated variables that keep track of the number of elements in the array (and in some cases, the separate number of allocated elements) need to be reset. Not all of these might technically be needed, but it's better to reset them if in doubt, to make sure variables don't end up conflicting. Signed-off-by: Martin Storsjö --- libavformat/mmst.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libavformat/mmst.c') diff --git a/libavformat/mmst.c b/libavformat/mmst.c index 41d01c4fc6..a17b4c12a8 100644 --- a/libavformat/mmst.c +++ b/libavformat/mmst.c @@ -337,8 +337,10 @@ static MMSSCPacketType get_tcp_server_response(MMSTContext *mmst) if(!mms->header_parsed) { if ((err = av_reallocp(&mms->asf_header, mms->asf_header_size + - mms->remaining_in_len)) < 0) + mms->remaining_in_len)) < 0) { + mms->asf_header_size = 0; return err; + } memcpy(mms->asf_header + mms->asf_header_size, mms->read_in_ptr, mms->remaining_in_len); mms->asf_header_size += mms->remaining_in_len; -- cgit v1.2.3