From 060206d121657d7e45c01ac022dd071c877b4caa Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Fri, 15 Jul 2011 13:46:02 +0300 Subject: [PATCH] Check the return value from RTMP_SendBytesReceived() This avoids double frees in RTMP_Close(), if the RTMP_SendBytesReceived() call failed, which earlier led to RTMP_ReadPacket() writing back an already freed buffer (freed by RTMP_Close() within WriteN()) into m_vecChannelsIn. --- librtmp/rtmp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/librtmp/rtmp.c b/librtmp/rtmp.c index 8d76164..f85cd83 100644 --- a/librtmp/rtmp.c +++ b/librtmp/rtmp.c @@ -1338,7 +1338,8 @@ ReadN(RTMP *r, char *buffer, int n) r->m_nBytesIn += nRead; if (r->m_bSendCounter && r->m_nBytesIn > r->m_nBytesInSent + r->m_nClientBW / 2) - SendBytesReceived(r); + if (!SendBytesReceived(r)) + return FALSE; } /*RTMP_Log(RTMP_LOGDEBUG, "%s: %d bytes\n", __FUNCTION__, nBytes); */ #ifdef _DEBUG -- 2.11.4.GIT