[Asterisk-code-review] res pjsip caller id: Use static pj str t for fromto header n... (asterisk[master])

Joshua Colp asteriskteam at digium.com
Mon Nov 19 08:40:06 CST 2018


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/10654 )

Change subject: res_pjsip_caller_id: Use static pj_str_t for fromto header names.
......................................................................

res_pjsip_caller_id: Use static pj_str_t for fromto header names.

PJSIP assumes that these header names are not allocated, does not clone
the name strings when reusing headers.

Block unload of res_pjsip_caller_id until shutdown to ensure static
memory stays valid.  It was previously unsafe to unload while any
sessions are active.

Change-Id: I190854dea943d6e441cf03733f8a0da661aea27f
---
M res/res_pjsip_caller_id.c
1 file changed, 2 insertions(+), 2 deletions(-)

Approvals:
  Sean Bright: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, but someone else must approve; Approved for Submit
  George Joseph: Looks good to me, approved



diff --git a/res/res_pjsip_caller_id.c b/res/res_pjsip_caller_id.c
index bc5ad8c..43bf178 100644
--- a/res/res_pjsip_caller_id.c
+++ b/res/res_pjsip_caller_id.c
@@ -430,8 +430,7 @@
 
 	id_hdr = pjsip_from_hdr_create(tdata->pool);
 	id_hdr->type = PJSIP_H_OTHER;
-	pj_strdup(tdata->pool, &id_hdr->name, hdr_name);
-	id_hdr->sname = id_hdr->name;
+	id_hdr->sname = id_hdr->name = *hdr_name;
 
 	id_name_addr = pjsip_uri_clone(tdata->pool, base->uri);
 	id_uri = pjsip_uri_get_uri(id_name_addr->uri);
@@ -779,6 +778,7 @@
 
 static int load_module(void)
 {
+	ast_module_shutdown_ref(AST_MODULE_SELF);
 	ast_sip_session_register_supplement(&caller_id_supplement);
 	return AST_MODULE_LOAD_SUCCESS;
 }

-- 
To view, visit https://gerrit.asterisk.org/10654
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I190854dea943d6e441cf03733f8a0da661aea27f
Gerrit-Change-Number: 10654
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2 (1000185)
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20181119/8e2ae283/attachment.html>


More information about the asterisk-code-review mailing list