From: Martin Storsjo Date: Fri, 15 Jul 2011 10:46:02 +0000 (+0300) Subject: Check the return value from RTMP_SendBytesReceived() X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=060206d121657d7e45c01ac022dd071c877b4caa;p=rtmpdump 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. --- 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