<p>I am using nathelper with usrloc in DB_ONLY mode in opensips 2.1 . I am having 2 domains (tables): location and location2. Location2 contains one contact entry and location none. I have set nathelper to do a SIP ping, but when get_all_ucontacts function from usrloc i get segmentation fault since it frees a null result.</p>
<pre><code>#0 0xb7785424 in __kernel_vsyscall ()
#1 0xb75c2607 in raise () from /lib/i386-linux-gnu/libc.so.6
#2 0xb75c5a33 in abort () from /lib/i386-linux-gnu/libc.so.6
#3 0x0811e041 in qm_free (qm=qm@entry=0xb7392008, p=p@entry=0xb73cb480, file=file@entry=0x81e074b "db/db_res.c", func=func@entry=0x81e077c <__FUNCTION__.7909> "db_free_result", line=line@entry=116) at mem/q_malloc.c:450
#4 0x08175bee in db_free_result (_r=_r@entry=0xb73cb480) at db/db_res.c:116
#5 0xb72b29e9 in db_mysql_free_result (_h=0xb73c67e4, _r=0xb73cb480) at dbase.c:921
#6 0xb6ea48c5 in get_all_db_ucontacts (part_max=<optimized out>, part_idx=<optimized out>, flags=<optimized out>, len=-4, buf=0x0) at dlist.c:323
#7 get_all_ucontacts (buf=0x0, len=0, flags=0, part_idx=0, part_max=1) at dlist.c:504
#8 0xb6e852d4 in nh_timer (ticks=1, timer_idx=0x0) at nathelper.c:1272
#9 0x080f2817 in handle_timer_job () at timer.c:565
#10 0x0819f915 in handle_io (idx=<optimized out>, event_type=<optimized out>, fm=<optimized out>) at net/net_udp.c:264
#11 io_wait_loop_epoll (h=<optimized out>, t=<optimized out>, repeat=<optimized out>) at net/../io_wait_loop.h:190
#12 udp_rcv_loop (si=si@entry=0xb73c6cb8) at net/net_udp.c:307
#13 0x081a1e3d in udp_start_processes (chd_rank=chd_rank@entry=0x82299a4 <chd_rank>, startup_done=startup_done@entry=0x0) at net/net_udp.c:447
#14 0x0805da18 in main_loop () at main.c:722
#15 main (argc=5, argv=0xbfca4574) at main.c:1253
</code></pre>
<pre><code>#6 0xb6ea48c5 in get_all_db_ucontacts (part_max=<optimized out>, part_idx=<optimized out>, flags=<optimized out>, len=-4, buf=0x0) at dlist.c:323
323 ul_dbf.free_result(ul_dbh, res);
</code></pre>
<p>More than this, if this bug is fixed, mysql returs the following error</p>
<pre><code>Jul 3 10:45:09 [5949] INFO:db_mysql:switch_state_to_disconnected: disconnect event for 0xb738a360
Jul 3 10:45:09 [5949] INFO:db_mysql:reset_all_statements: reseting all statements on connection: (0xb73857e4) 0xb738a360
Jul 3 10:45:09 [5949] INFO:db_mysql:connect_with_retry: re-connected successful for 0xb738a360
</code></pre>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href="https://github.com/OpenSIPS/opensips/issues/566">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AFOciWViHrcjf6Mru6i6GgKKoEUMKMpLks5oZjl-gaJpZM4FRSo3.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
<link itemprop="url" href="https://github.com/OpenSIPS/opensips/issues/566"></link>
<meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>