I've encountered a problem - sometimes OpenSIPS 1.6.0 crashes. GDB says that crash was in stun.c, line 836. Going to this line, we see:<br><br>case UNKNOWN_ATTRIBUTES:<br> /* iterator */<br> b2 = (T16 *) msg->unknownAttributes->buffer;<br>
/* allocate unknownAttributes buffer */<br> msg->unknownAttributes = (Buffer*) pkg_malloc(sizeof(Buffer));<br> if(!msg->unknownAttributes){<br> LM_DBG("out of mem\n");<br>
return -1;<br> }<br> memset(msg->unknownAttributes, 0, sizeof(Buffer));<br><br>Is it OK, that we create iterator, and then allocate buffer? uknownAttributes is not allocated when iterator is created. I've changed it to:<br>
<br>case UNKNOWN_ATTRIBUTES:<br> /* allocate unknownAttributes buffer */<br> msg->unknownAttributes = (Buffer*) pkg_malloc(sizeof(Buffer));<br> if(!msg->unknownAttributes){<br>
LM_DBG("out of mem\n");<br> return -1;<br> }<br> memset(msg->unknownAttributes, 0, sizeof(Buffer));<br><br> /* iterator */<br>
b2 = (T16 *) msg->unknownAttributes->buffer;<br><br> Now it seems to work properly.<br><br> By the way, version 1.6.1 contains the same bug in STUN module. <span class="translation">Unfortunately, 1.6.1 is unusable for me - crashes too often :( I wrote one report about crash on NOTIFY (with backtrace), and today I've encountered another crash:<br>
<br>Program terminated with signal 11, Segmentation fault.<br>[New process 19330]<br>#0 0x080ec3d9 in fm_malloc (qm=0x81b3c00, size=<value optimized out>) at mem/f_malloc.c:172<br>172 *pf=n->u.nxt_free;<br>
(gdb) where<br>#0 0x080ec3d9 in fm_malloc (qm=0x81b3c00, size=<value optimized out>) at mem/f_malloc.c:172<br>#1 0x00603d04 in build_rr (_l=0x81e07d8, _l2=0x81e1d1c, user=0xbff381d0, tag=0x81d1fc0, params=0x0, _inbound=1) at record.c:163<br>
#2 0x0060471f in record_route (_m=0x81d1bec, params=0x0) at record.c:320<br>#3 0x00606031 in w_record_route (msg=0x81d1bec, key=0x0, bar=0x0) at rr_mod.c:272<br>#4 0x080545dd in do_action (a=0x81bdb2c, msg=0x81d1bec) at action.c:967<br>
#5 0x08057308 in run_action_list (a=0x81bdb2c, msg=0x81d1bec) at action.c:139<br>#6 0x080554dd in do_action (a=0x81bdb98, msg=0x81d1bec) at action.c:706<br>#7 0x08057308 in run_action_list (a=0x81bd578, msg=0x81d1bec) at action.c:139<br>
#8 0x080576a3 in run_top_route (a=0x81bd578, msg=0x81d1bec) at action.c:119<br>#9 0x0809ddf2 in receive_msg (<br> buf=0x8192380 "OPTIONS sip:<a href="http://sip.comtube.ru">sip.comtube.ru</a> SIP/2.0\r\nVia: SIP/2.0/UDP 85.21.245.172:5060;branch=z9hG4bK57769584;rport\r\nMax-Forwards: 69\r\nFrom: \"asterisk\" <<a href="mailto:sip%3Aasterisk@85.21.245.172">sip:asterisk@85.21.245.172</a>>;tag=as58d6d6b9\r\nTo: <sip:sip.comtu"..., len=511, rcv_info=0xbff388d4) at receive.c:162<br>
#10 0x080e5056 in udp_rcv_loop () at udp_server.c:492<br>#11 0x08070adf in main (argc=5, argv=0xbff38ae4) at main.c:821<br></span>