[rtmpdump] [PATCH 1/2] Check the return value from RTMP_SendBytesReceived()

Martin Storsjo martin at martin.st
Fri Jul 15 12:46:02 CEST 2011


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 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/librtmp/rtmp.c b/librtmp/rtmp.c
index 5ef3ae9..064a934 100644
--- a/librtmp/rtmp.c
+++ b/librtmp/rtmp.c
@@ -1330,7 +1330,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
-- 
1.7.3.1



More information about the rtmpdump mailing list