diff --git a/core/AmRtpStream.cpp b/core/AmRtpStream.cpp index 5316501c..ae28aaed 100644 --- a/core/AmRtpStream.cpp +++ b/core/AmRtpStream.cpp @@ -119,6 +119,7 @@ int AmRtpStream::getLocalSocket() } if((rtcp_sd = socket(l_saddr.ss_family,SOCK_DGRAM,0)) == -1) { + close(sd); ERROR("%s\n",strerror(errno)); throw string ("while creating new socket."); } @@ -127,12 +128,14 @@ int AmRtpStream::getLocalSocket() if(ioctl(sd, FIONBIO , &true_opt) == -1){ ERROR("%s\n",strerror(errno)); close(sd); + close(rtcp_sd); throw string ("while setting socket non blocking."); } if(ioctl(rtcp_sd, FIONBIO , &true_opt) == -1){ ERROR("%s\n",strerror(errno)); close(sd); + close(rtcp_sd); throw string ("while setting socket non blocking."); }