]> granicus.if.org Git - rtmpdump/commitdiff
Check the return value from RTMP_SendBytesReceived()
authorMartin Storsjo <martin@martin.st>
Fri, 15 Jul 2011 10:46:02 +0000 (13:46 +0300)
committerHoward Chu <hyc@highlandsun.com>
Sat, 23 Jul 2011 01:00:29 +0000 (18:00 -0700)
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

index 8d76164f43f32baca126e1bcb5b46465a1fcf6e0..f85cd8344a3d790c6c311528d74554bfe8df8e94 100644 (file)
@@ -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