<ul>
<li>Add missing pkg_free for the dynamic PV name created during PV parsing</li>
<li>Add missing pkg_free for any GPARAM_TYPE_PVS created during PV parsing</li>
</ul>
<h4>Pre-Submission Checklist</h4>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Commit message has the format required by CONTRIBUTING guide</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Commits are split per component (core, individual modules, libs, utils, ...)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Each component has a single commit (if not, squash them into one commit)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> No commits to README files for modules (changes must be done to docbook files<br>
in <code>doc/</code> subfolder, the README file is autogenerated)</li>
</ul>
<h4>Type Of Change</h4>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Small bug fix (non-breaking change which fixes an issue)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> New feature (non-breaking change which adds new functionality)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Breaking change (fix or feature that would change existing functionality)</li>
</ul>
<h4>Checklist:</h4>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> PR should be backported to stable branches</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Tested changes locally</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Related to issue #XXXX (replace XXXX with an open issue number)</li>
</ul>
<h4>Description</h4>
<p>We are using NDB_REDIS in anger, fetching data from changing hash structures. NDB_REDIS creates dynamic PVs, and in order to do so it has a custom parser that allocates a dynamic PV structure as well as potentially multiple nested parameter structures. We very quickly found that we were running out of package memory, and enabling Kamailio's own memory debug logging quickly revealed that every <code>$redis(...)</code> query was leaking.</p>
<p>It appears that the allocated structures are only used within the subsequent handler to fetch the data. Therefore, to resolve the leak, the allocated structures are freed after the data for the PV in question has been fetched.</p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/kamailio/kamailio/pull/2536'>https://github.com/kamailio/kamailio/pull/2536</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>ndb_redis: Fix leaks from PV parsing</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/kamailio/kamailio/pull/2536/files#diff-5b5a751abe83a8dc0bd6b9086dd5ee22d784d794789b24e9b6270833526f7e20">src/modules/ndb_redis/ndb_redis_mod.c</a>
    (24)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/kamailio/kamailio/pull/2536.patch'>https://github.com/kamailio/kamailio/pull/2536.patch</a></li>
  <li><a href='https://github.com/kamailio/kamailio/pull/2536.diff'>https://github.com/kamailio/kamailio/pull/2536.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/kamailio/kamailio/pull/2536">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZLS3ZYPWFBMFTW6K2LSND3URANCNFSM4TDH3LZA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABO7UZKTNGQ3ZU2ZO4AK3HDSND3URA5CNFSM4TDH3LZKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4K5BSEVQ.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/kamailio/kamailio/pull/2536",
"url": "https://github.com/kamailio/kamailio/pull/2536",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>