[asterisk-commits] res pjsip outbound publish: Potential crash due to off nomin... (asterisk[13])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 19 05:12:47 CDT 2016


Joshua Colp has submitted this change and it was merged.

Change subject: res_pjsip_outbound_publish: Potential crash due to off nominal path
......................................................................


res_pjsip_outbound_publish: Potential crash due to off nominal path

It was possible for the explicit publish destroy function to be called without
the pjsip client ever being initialized. This fix checks to make sure there is
a client to destroy before attempting.

Change-Id: I8eea1bfa3bd472149bfc255310be2a6248688f5c
---
M res/res_pjsip_outbound_publish.c
1 file changed, 9 insertions(+), 2 deletions(-)

Approvals:
  Mark Michelson: Looks good to me, approved
  George Joseph: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, but someone else must approve; Verified



diff --git a/res/res_pjsip_outbound_publish.c b/res/res_pjsip_outbound_publish.c
index 60f9bbb..bf933cb 100644
--- a/res/res_pjsip_outbound_publish.c
+++ b/res/res_pjsip_outbound_publish.c
@@ -687,8 +687,15 @@
 {
 	struct ast_sip_outbound_publish_client *client = data;
 
-	pjsip_publishc_destroy(client->client);
-	ao2_ref(client, -1);
+	/*
+	 * If there is no pjsip publishing client then we obviously don't need
+	 * to destroy it. Also, the ref for the Asterisk publishing client that
+	 * pjsip had would not exist or should already be gone as well.
+	 */
+	if (client->client) {
+		pjsip_publishc_destroy(client->client);
+		ao2_ref(client, -1);
+	}
 
 	return 0;
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I8eea1bfa3bd472149bfc255310be2a6248688f5c
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-commits mailing list