<p></p>
<h3>Description</h3>
<p>I've faced a critical error in the log after upgrade to 5.5 on <em>topos</em> module.</p>
<h3>Troubleshooting</h3>
<p>It looks like <em>ki_tps_set_context()</em> tries to free incorrectly defined variable _<em>tps_context_value</em>.</p>
<h4>Reproduction</h4>
<pre><code>loadmodule "topos.so"
modparam("topos", "storage", "db")
modparam("topos", "db_url", DBURL_PRIMARY)
modparam("topos", "sanity_checks", 1)
modparam("topos", "branch_expire", 300)
modparam("topos", "dialog_expire", 7200)
modparam("topos", "clean_interval", 120)
</code></pre>
<h4>Log Messages</h4>
<pre><code>20:59:43.951476 kamailio 81412 CRITICAL: <core> [core/mem/q_malloc.c:502]: qm_free(): BUG: bad pointer 0x82310fbdc (out of memory block!) called from topos: topos_mod.c: ki_tps_set_context(315) - ignoring
20:59:58.925224 kamailio 81413 CRITICAL: <core> [core/mem/q_malloc.c:502]: qm_free(): BUG: bad pointer 0x82310fbdc (out of memory block!) called from topos: topos_mod.c: ki_tps_set_context(315) - ignoring
21:00:13.930896 kamailio 81414 CRITICAL: <core> [core/mem/q_malloc.c:502]: qm_free(): BUG: bad pointer 0x82310fbdc (out of memory block!) called from topos: topos_mod.c: ki_tps_set_context(315) - ignoring
21:00:28.929303 kamailio 81415 CRITICAL: <core> [core/mem/q_malloc.c:502]: qm_free(): BUG: bad pointer 0x82310fbdc (out of memory block!) called from topos: topos_mod.c: ki_tps_set_context(315) - ignoring
21:00:43.925256 kamailio 81416 CRITICAL: <core> [core/mem/q_malloc.c:502]: qm_free(): BUG: bad pointer 0x82310fbdc (out of memory block!) called from topos: topos_mod.c: ki_tps_set_context(315) - ignoring
21:00:58.925535 kamailio 81417 CRITICAL: <core> [core/mem/q_malloc.c:502]: qm_free(): BUG: bad pointer 0x82310fbdc (out of memory block!) called from topos: topos_mod.c: ki_tps_set_context(315) - ignoring
21:01:13.925081 kamailio 81418 CRITICAL: <core> [core/mem/q_malloc.c:502]: qm_free(): BUG: bad pointer 0x82310fbdc (out of memory block!) called from topos: topos_mod.c: ki_tps_set_context(315) - ignoring
21:01:28.925306 kamailio 81419 CRITICAL: <core> [core/mem/q_malloc.c:502]: qm_free(): BUG: bad pointer 0x82310fbdc (out of memory block!) called from topos: topos_mod.c: ki_tps_set_context(315) - ignoring
</code></pre>
<h3>Additional Information</h3>
<pre><code>version: kamailio 5.5.0 (x86_64/freebsd) d4c1a1
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLOCKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, select, kqueue.
id: d4c1a1 
compiled on 13:02:36 May 13 2021 with cc FreeBSD clang version 10.0.1 (git@github.com:llvm/llvm-project.git llvmorg-10.0.1-0-gef32c611aa2)
</code></pre>
<ul>
<li><strong>Operating System</strong>:<br>
FreeBSD 13</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/issues/2734">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABO7UZMZ3NDMW2ZSZORUKKLTNPKBBANCNFSM442SWU5A">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABO7UZIPVZS3G3SNY3NQR43TNPKBBA5CNFSM442SWU5KYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4NI4OBPA.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/issues/2734",
"url": "https://github.com/kamailio/kamailio/issues/2734",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>