<blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><p style="white-space: pre-wrap; word-wrap: break-word;">May be better to set caller_id_tag to empty string only for<br>res_pjsip.<br>For example inside sip_endpoint_apply_handler() could be added<br>if (!endpoint->id.self.tag) {<br>endpoint->id.self.tag=ast_strdup("");<br>}</p></blockquote><p style="white-space: pre-wrap; word-wrap: break-word;">That makes a lot of sense.</p><p style="white-space: pre-wrap; word-wrap: break-word;">ast_sip_endpoint_alloc() needs to set the tag to an empty<br>ast_strdup() string after calling ast_party_id_init().<br>caller_id_tag_handler() needs to free the previous tag or we leak<br>memory.  (This would be true if there were more than one<br>callerid_tag in the pjsip.conf endpoint definition anyway.)</p></blockquote><p style="white-space: pre-wrap; word-wrap: break-word;">What's the reason to assign empty value before config processing?<br>If the tag has value then will be ast_strdup()/ast_free()/ast_strdup().<br>If assign empty value after config processing at sip_endpoint_apply_handler()<br>then will be only one ast_strdup() in any cases.</p><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><br> > Oh gosh: caller_id_handler() needs to free the name.str, and<br> > number.str before assigning the new ast_strdup() or we leak memory<br> > if there is more than one callerid option in the pjsip.conf<br> > endpoint definition.<br>The next functions leak memory on multi options:<br>caller_id_handler<br>caller_id_tag_handler<br>voicemail_extension_handler<br>contact_user_handler</pre><p><a href="https://gerrit.asterisk.org/10286">View Change</a></p><ul style="list-style: none; padding: 0;"></ul><p>To view, visit <a href="https://gerrit.asterisk.org/10286">change 10286</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/10286"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: comment </div>
<div style="display:none"> Gerrit-Change-Id: I6ce9e151a2220ce9e95aa66666933cfb9e2a4a01 </div>
<div style="display:none"> Gerrit-Change-Number: 10286 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: Alexei Gradinari <alex2grad@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: Alexei Gradinari <alex2grad@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 (1000185) </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Thu, 11 Oct 2018 20:46:29 +0000 </div>
<div style="display:none"> Gerrit-HasComments: No </div>
<div style="display:none"> Gerrit-HasLabels: No </div>