]> granicus.if.org Git - rtmpdump/commitdiff
Don't try to close an already closed socket
authorMartin Storsjo <martin@martin.st>
Fri, 15 Jul 2011 10:46:03 +0000 (13:46 +0300)
committerHoward Chu <hyc@highlandsun.com>
Sat, 23 Jul 2011 01:01:11 +0000 (18:01 -0700)
This could happen if WriteN() (called within SendBytesReceived())
failed.

librtmp/rtmp.c

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