[rtmpdump] branch master updated. 159a06e Don't try to close an already closed socket

gitolite gil at avcodec.org
Sat Jul 23 03:01:41 CEST 2011


The branch, master has been updated
       via  159a06ebe6d82ef20f2c77c497d55af00d2e0b78 (commit)
       via  060206d121657d7e45c01ac022dd071c877b4caa (commit)
      from  9931c44867d157621ae10cf489ba336091dfab6b (commit)


- Log -----------------------------------------------------------------
commit 159a06ebe6d82ef20f2c77c497d55af00d2e0b78
Author:     Martin Storsjo <martin at martin.st>
AuthorDate: Fri Jul 15 13:46:03 2011 +0300
Commit:     Howard Chu <hyc at highlandsun.com>
CommitDate: Fri Jul 22 18:01:11 2011 -0700

    Don't try to close an already closed socket
    
    This could happen if WriteN() (called within SendBytesReceived())
    failed.

diff --git a/librtmp/rtmp.c b/librtmp/rtmp.c
index f85cd83..df2cb27 100644
--- a/librtmp/rtmp.c
+++ b/librtmp/rtmp.c
@@ -3626,7 +3626,9 @@ RTMPSockBuf_Close(RTMPSockBuf *sb)
       sb->sb_ssl = NULL;
     }
 #endif
-  return closesocket(sb->sb_socket);
+  if (sb->sb_socket != -1)
+      return closesocket(sb->sb_socket);
+  return 0;
 }
 
 #define HEX2BIN(a)	(((a)&0x40)?((a)&0xf)+9:((a)&0xf))

commit 060206d121657d7e45c01ac022dd071c877b4caa
Author:     Martin Storsjo <martin at martin.st>
AuthorDate: Fri Jul 15 13:46:02 2011 +0300
Commit:     Howard Chu <hyc at highlandsun.com>
CommitDate: Fri Jul 22 18:00:29 2011 -0700

    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

-----------------------------------------------------------------------

Summary of changes:
 librtmp/rtmp.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)


hooks/post-receive
-- 



More information about the rtmpdump mailing list