<p> Attention is currently required from: Sean Bright, N A. </p>
<p><a href="https://gerrit.asterisk.org/c/asterisk/+/18829">View Change</a></p><p>1 comment:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="null">Patchset:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/c/asterisk/+/18829?tab=comments">Patch Set #19:</a> </p><p style="white-space: pre-wrap; word-wrap: break-word;">Patchset 19:</p><p style="white-space: pre-wrap; word-wrap: break-word;">Now the thread_init doesn't do the incorrect memcpy to some where, it now set's the *data to the new_redisContext. I hope that's correct?.</p><p style="white-space: pre-wrap; word-wrap: break-word;">I'm still getting the double free with debugging on in my hiredis_thread_cleanup().</p><p style="white-space: pre-wrap; word-wrap: break-word;">The double free I'm sure is because redisFree() free's the context see hi_free(c) at end of code below, then ast_unregister_thread also tries to free the same context.</p><p style="white-space: pre-wrap; word-wrap: break-word;">code from hiredis library https://github.com/redis/hiredis/blob/master/hiredis.c line 719</p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">void redisFree(redisContext *c) {<br>    if (c == NULL)<br>        return;<br>    redisNetClose(c);</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">    sdsfree(c->obuf);<br>    redisReaderFree(c->reader);<br>    hi_free(c->tcp.host);<br>    hi_free(c->tcp.source_addr);<br>    hi_free(c->unix_sock.path);<br>    hi_free(c->connect_timeout);<br>    hi_free(c->command_timeout);<br>    hi_free(c->saddr);</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">    if (c->privdata && c->free_privdata)<br>        c->free_privdata(c->privdata);</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">    if (c->funcs->free_privctx)<br>        c->funcs->free_privctx(c->privctx);</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">    memset(c, 0xff, sizeof(*c));<br>    hi_free(c);                              <<<<<<<<<< cause of double free <<<<<<<<<<<<<br>}</pre><p style="white-space: pre-wrap; word-wrap: break-word;">How can this double free properly be worked around?</p><p style="white-space: pre-wrap; word-wrap: break-word;">1.)perhaps malloc a dummy redisContext, assign it to threadstorage, then let ast_unregister_thread  free it.<br>2.) get the hiredis library to have a function that release all resources except for the context.</p><p style="white-space: pre-wrap; word-wrap: break-word;">Alec</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/18829">change 18829</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/c/asterisk/+/18829"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ifdf4d33d2a2a5fd044fac13b201c7437de34ba6a </div>
<div style="display:none"> Gerrit-Change-Number: 18829 </div>
<div style="display:none"> Gerrit-PatchSet: 19 </div>
<div style="display:none"> Gerrit-Owner: Alec Davis <alec@bdt.co.nz> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-Reviewer: N A <mail@interlinked.x10host.com> </div>
<div style="display:none"> Gerrit-Reviewer: Sean Bright <sean@seanbright.com> </div>
<div style="display:none"> Gerrit-Attention: Sean Bright <sean@seanbright.com> </div>
<div style="display:none"> Gerrit-Attention: N A <mail@interlinked.x10host.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Wed, 03 Aug 2022 07:29:34 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-Has-Labels: No </div>
<div style="display:none"> Gerrit-MessageType: comment </div>