[Asterisk-code-review] res rtp asterisk: Avoid close the rtp/rtcp fd twice. (asterisk[master])

Richard Mudgett asteriskteam at digium.com
Mon Dec 18 15:58:43 CST 2017


Richard Mudgett has posted comments on this change. ( https://gerrit.asterisk.org/7618 )

Change subject: res_rtp_asterisk:  Avoid close the rtp/rtcp fd twice.
......................................................................


Patch Set 1: Code-Review-1

(1 comment)

https://gerrit.asterisk.org/#/c/7618/1/res/res_rtp_asterisk.c
File res/res_rtp_asterisk.c:

https://gerrit.asterisk.org/#/c/7618/1/res/res_rtp_asterisk.c@3501
PS1, Line 3501: 	if (rtp->rtcp && rtp->rtcp->s > -1 && rtp->rtcp->s != saved_rtp_s) {
              : 		close(rtp->rtcp->s);
              : 		rtp->rtcp->s = -1;
              : 	}
This will leave rtp->rtcp->s not set to -1 if it was the same socket as rtp->s.

For safety, it should be:

if (rtp->rtcp && rtp->rtcp->s > -1) {
   if (saved_rtp_s != rtp->rtcp->s) {
      close(rtp->rtcp->s);
   }
   rtp->rtcp->s = -1;
}



-- 
To view, visit https://gerrit.asterisk.org/7618
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I870a072d73fd207463ac116ef97100addbc0820a
Gerrit-Change-Number: 7618
Gerrit-PatchSet: 1
Gerrit-Owner: Aaron An <anjb at ti-net.com.cn>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Comment-Date: Mon, 18 Dec 2017 21:58:43 +0000
Gerrit-HasComments: Yes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171218/e5ea862f/attachment.html>


More information about the asterisk-code-review mailing list