[asterisk-commits] CHAOS: cleanup possible null vars on msg alloc failure (asterisk[13])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Mar 2 18:12:00 CST 2016


Joshua Colp has submitted this change and it was merged.

Change subject: CHAOS: cleanup possible null vars on msg alloc failure
......................................................................


CHAOS: cleanup possible null vars on msg alloc failure

In message.c, if msg_alloc fails to init the string field,
vars may be null, so use a null tolerant cleanup.

In res_pjsip_messaging.c, if msg_data_create fails, mdata
will be null, so use a null tolerant cleanup.

ASTERISK-25323

Change-Id: Ic2d55c2c3750d5616e2a05ea92a19c717507ff56
---
M main/message.c
M res/res_pjsip_messaging.c
2 files changed, 2 insertions(+), 2 deletions(-)

Approvals:
  Kevin Harwell: Looks good to me, but someone else must approve
  Richard Mudgett: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Verified



diff --git a/main/message.c b/main/message.c
index 01a1c9b..c15975b 100644
--- a/main/message.c
+++ b/main/message.c
@@ -398,7 +398,7 @@
 	struct ast_msg *msg = obj;
 
 	ast_string_field_free_memory(msg);
-	ao2_ref(msg->vars, -1);
+	ao2_cleanup(msg->vars);
 }
 
 struct ast_msg *ast_msg_alloc(void)
diff --git a/res/res_pjsip_messaging.c b/res/res_pjsip_messaging.c
index 54880db..f7d2e0a 100644
--- a/res/res_pjsip_messaging.c
+++ b/res/res_pjsip_messaging.c
@@ -597,7 +597,7 @@
 
 	if (!(mdata = msg_data_create(msg, to, from)) ||
 	    ast_sip_push_task(message_serializer, msg_send, mdata)) {
-		ao2_ref(mdata, -1);
+		ao2_cleanup(mdata);
 		return -1;
 	}
 	return 0;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic2d55c2c3750d5616e2a05ea92a19c717507ff56
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Scott Griepentrog <sgriepentrog at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-commits mailing list