<p>Richard Mudgett has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/8286">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">pjproject: Improve MALLOC_DEBUG checking.<br><br>Disable pjproject pool caching when MALLOC_DEBUG is enabled to catch use<br>after free of the pool control structs as well as the struct that created<br>the pool.<br><br>Change-Id: I64d5befbaeed2532f93aa027a51eb52347d2b828<br>---<br>A third-party/pjproject/patches/0000-malloc_debug.patch<br>1 file changed, 28 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/86/8286/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/third-party/pjproject/patches/0000-malloc_debug.patch b/third-party/pjproject/patches/0000-malloc_debug.patch<br>new file mode 100644<br>index 0000000..d4d37ec<br>--- /dev/null<br>+++ b/third-party/pjproject/patches/0000-malloc_debug.patch<br>@@ -0,0 +1,28 @@<br>+diff --git a/pjlib/src/pj/pool_caching.c b/pjlib/src/pj/pool_caching.c<br>+index 8e2c992..4c89cd9 100644<br>+--- a/pjlib/src/pj/pool_caching.c<br>++++ b/pjlib/src/pj/pool_caching.c<br>+@@ -226,6 +226,15 @@ static void cpool_release_pool( pj_pool_factory *pf, pj_pool_t *pool)<br>+     /* Decrement used count. */<br>+     --cp->used_count;<br>+ <br>++#if defined(MALLOC_DEBUG)<br>++    /*<br>++     * Disable caching pools when MALLOC_DEBUG is enabled to<br>++     * better catch memory mis-management.<br>++     */<br>++    pj_pool_destroy_int(pool);<br>++<br>++#else<br>++<br>+     pool_capacity = pj_pool_get_capacity(pool);<br>+ <br>+     /* Destroy the pool if the size is greater than our size or if the total<br>+@@ -263,6 +272,7 @@ static void cpool_release_pool( pj_pool_factory *pf, pj_pool_t *pool)<br>+ <br>+     pj_list_insert_after(&cp->free_list[i], pool);<br>+     cp->capacity += pool_capacity;<br>++#endif<br>+ <br>+     pj_lock_release(cp->lock);<br>+ }<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/8286">change 8286</a>. To unsubscribe, 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/8286"/><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: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I64d5befbaeed2532f93aa027a51eb52347d2b828 </div>
<div style="display:none"> Gerrit-Change-Number: 8286 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Richard Mudgett <rmudgett@digium.com> </div>