From 271c869cc3285dac2b6f2663a87c70bf3ba2b04f Mon Sep 17 00:00:00 2001 From: Martin Storsjö Date: Wed, 25 May 2011 19:08:29 +0300 Subject: rtmp: Don't try to do av_malloc(0) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some received packets can have size 0. The return value from av_malloc(0) may be NULL, which is ok if the size was 0. On OS X, however, the returned pointer is non-null but leads to crashes when trying to free it. Signed-off-by: Martin Storsjö --- libavformat/rtmpproto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libavformat/rtmpproto.c') diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index 70e4b142d6..f499bd3b71 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -683,7 +683,7 @@ static int get_packet(URLContext *s, int for_header) return AVERROR_EOF; for (;;) { - RTMPPacket rpkt; + RTMPPacket rpkt = { 0 }; if ((ret = ff_rtmp_packet_read(rt->stream, &rpkt, rt->chunk_size, rt->prev_pkt[0])) <= 0) { if (ret == 0) { -- cgit v1.2.3