]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_rtp_asterisk: Avoid close the rtp/rtcp fd twice.
authorAaron An <anjb@ti-net.com.cn>
Tue, 19 Dec 2017 20:15:29 +0000 (15:15 -0500)
committerCorey Farrell <git@cfware.com>
Tue, 19 Dec 2017 20:16:02 +0000 (15:16 -0500)
When RTCP-MUX enabled. rtp->s is the same as rtcp->s, check this before
close the file descriptor. Close the FD twice will hangs the asterisk
under heavy load.

ASTERISK-27299 #close
Reported-by: Aaron An
Tested-by: AaronAn
Change-Id: I870a072d73fd207463ac116ef97100addbc0820a

res/res_rtp_asterisk.c

index 230d147be3f32e2dd46cbb1ee4993453cc14af3f..263dbff18b1e7495960fe2bc4f25b502eadd0b0f 100644 (file)
@@ -3247,7 +3247,9 @@ static int ast_rtp_destroy(struct ast_rtp_instance *instance)
                 * entry at this point since it holds a reference to the
                 * RTP instance while it's active.
                 */
-               close(rtp->rtcp->s);
+               if (rtp->rtcp->s > -1 && rtp->s != rtp->rtcp->s) {
+                       close(rtp->rtcp->s);
+               }
                ast_free(rtp->rtcp->local_addr_str);
                ast_free(rtp->rtcp);
        }