<p>Hi <a href="https://github.com/mikomarrache" class="user-mention">@mikomarrache</a> - the val points into parser memory (lex/yacc) and it is no longer available after the script parsing was done.<br>
When having the a STR param, it is a must to clone it as the module gets access to that param only after the cfg parsing.<br>
With the function, this function is called during the cfg parsing, so there is no need to clone the val. OF course, the function should not keep the val pointer after its ending. If it needs to store the val, the function itself must do the cloning.<br>
So, the code is ok, but you need to be careful in param functions and clone the val if you need it outside function scope.</p>

<p>Regards, Bogdan</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br>Reply to this email directly or <a href="https://github.com/OpenSIPS/opensips/issues/349#issuecomment-59344580">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/5479561__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcyOTA3NTk1MywiZGF0YSI6eyJpZCI6NDQ4MDUwMDF9fQ==--1a64b557537d708f3d59b7a06d5e17fd6ca225cb.gif" width="1" /></p>
<script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"View this Issue on GitHub","action":{"@type":"ViewAction","url":"https://github.com/OpenSIPS/opensips/issues/349#issuecomment-59344580","name":"View Issue"}}</script>