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

Kevin Harwell asteriskteam at digium.com
Wed May 11 11:41:39 CDT 2016


Kevin Harwell has uploaded a new change for review.

  https://gerrit.asterisk.org/2806

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(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/06/2806/1

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: newchange
Gerrit-Change-Id: I8eea1bfa3bd472149bfc255310be2a6248688f5c
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>



More information about the asterisk-code-review mailing list