[Asterisk-code-review] res pjsip pubsub: Address SEGV when attempting to terminate ... (asterisk[13])

Richard Mudgett asteriskteam at digium.com
Tue Jun 21 13:09:41 CDT 2016


Richard Mudgett has posted comments on this change.

Change subject: res_pjsip_pubsub: Address SEGV when attempting to terminate a subscription
......................................................................


Patch Set 7: Code-Review-1

(8 comments)

Minor nits but OK otherwise.

https://gerrit.asterisk.org/#/c/3018/7/res/res_pjsip_pubsub.c
File res/res_pjsip_pubsub.c:

PS7, Line 2290: 	if (sub_tree->state >= SIP_SUB_TREE_TERMINATE_IN_PROGRESS) {
              : 		pjsip_dlg_dec_lock(dlg);
              : 		ao2_cleanup(sub_tree);
              : 		return 0;
              : 	}
              : 
              : 	/* It's possible that between when the notification was scheduled
              : 	 * and now, that a new SUBSCRIBE arrived, requiring full state to be
              : 	 * sent out in an immediate NOTIFY. If that has happened, we need to
              : 	 * bail out here instead of sending the batched NOTIFY.
              : 	 */
              : 	if (!sub_tree->send_scheduled_notify) {
              : 		pjsip_dlg_dec_lock(dlg);
              : 		ao2_cleanup(sub_tree);
              : 		return 0;
              : 	}
These two ifs can be combined into one:

if (state >= terminate_in_progress || !send_sched_notify)


Line 2315: 		? "SUBSCRIPTION_TERMINATED" : "SUBSCRIPTION_STATE_CHANGED",
inconsistent indentation

Increase this line indentation by one tab since it is a line continuation of an incomplete ternary expression


PS7, Line 2316: 			"Resource: %s",
              : 			sub_tree->root->resource);
inconsistent indentation

remove one tab from these two lines.


Line 2362: 	if (sub->tree->state >= SIP_SUB_TREE_TERMINATE_PENDING) {
This probably should test as if not normal for better semantic meaning.

if (sub->tree->state != SIP_SUB_TREE_NORMAL)


Line 3439: 	struct sip_subscription_tree *sub_tree = NULL;
Setting to NULL is not needed as the first reference initializes it.


Line 3509:  * In either case we push serialized_pubsub_on_refresh_timeout to send an appropriate NOTIFY request.
long line


Line 3514: 	struct sip_subscription_tree *sub_tree = NULL;
Setting to NULL is not needed as the first reference initializes it.


Line 3590: 	struct sip_subscription_tree *sub_tree = NULL;
Setting to NULL is not needed as the first reference initializes it.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I779d11802cf672a51392e62a74a1216596075ba1
Gerrit-PatchSet: 7
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-HasComments: Yes



More information about the asterisk-code-review mailing list