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

Kevin Harwell asteriskteam at digium.com
Tue May 3 16:11:21 CDT 2016


Kevin Harwell has uploaded a new change for review.

  https://gerrit.asterisk.org/2750

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/50/2750/1

diff --git a/res/res_pjsip_outbound_publish.c b/res/res_pjsip_outbound_publish.c
index 0265c42..ed06a33 100644
--- a/res/res_pjsip_outbound_publish.c
+++ b/res/res_pjsip_outbound_publish.c
@@ -701,8 +701,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/2750
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8eea1bfa3bd472149bfc255310be2a6248688f5c
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>



More information about the asterisk-code-review mailing list