diff --git a/daemon/call.c b/daemon/call.c index f372373e6..e98ce680b 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -416,7 +416,7 @@ good: static void callmaster_timer(void *ptr) { struct callmaster *m = ptr; struct iterator_helper hlp; - GList *i; + GList *i, *n; struct call *c; struct mediaproxy_list_entry *ke; struct streamrelay *sr; @@ -453,12 +453,12 @@ next: i = g_list_delete_link(i, i); } - for (i = hlp.del; i; i = i->next) { + for (i = hlp.del; i; i = n) { + n = i->next; c = i->data; call_destroy(c); + g_list_free_1(i); } - - g_list_free(i); } #undef DS diff --git a/iptables-extension/libipt_MEDIAPROXY-1.4.c b/iptables-extension/libipt_MEDIAPROXY-1.4.c index 799ebc7f4..f0d167d60 100644 --- a/iptables-extension/libipt_MEDIAPROXY-1.4.c +++ b/iptables-extension/libipt_MEDIAPROXY-1.4.c @@ -1,4 +1,4 @@ -/* gcc -O2 -Wall -shared -o libipt_MEDIAPROXY.so libipt_MEDIAPROXY.c */ +/* gcc -O2 -Wall -shared -fPIC -o libipt_MEDIAPROXY.so libipt_MEDIAPROXY-1.4.c */ #include #include diff --git a/tests/simulator.sh b/tests/simulator.sh new file mode 100755 index 000000000..7628e7aa7 --- /dev/null +++ b/tests/simulator.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# # G_SLICE=always-malloc valgrind --leak-check=full --track-origins=yes --show-possibly-lost=yes ./mediaproxy-ng -t 0 -i $IP -l 25060 -f + +pipe_o() { + nc localhost 25060 +} +pipe() { + pipe_o > /dev/null +} +ip() { + echo $(($RANDOM % 254 + 1)).$(($RANDOM % 254 + 1)).$(($RANDOM % 254 + 1)).$(($RANDOM % 254 + 1)) +} +port() { + echo $(($RANDOM % 64000 + 1024)) +} + +ids="" +for i in $(seq 1 1000); do + callid=`uuid` + test -z "$callid" && exit 1 + src=`ip`:`port` + dst=`ip`:`port` + gw=`ip` + fromtag=`uuid` + totag=`uuid` + + src_rel=`echo "request $callid $src:audio $gw voip.inode.at local unknown unknown unknown-agent info=domain:voip.sipwise.local,from:number@voip.inode.at,totag:,to:othernumber@voip.inode.at,fromtag:$fromtag" | pipe_o` + dst_rel=`echo "lookup $callid $dst:audio $gw voip.inode.at local unknown unknown unknown-agent info=domain:voip.sipwise.local,from:number@voip.inode.at,totag:$totag,to:othernumber@voip.inode.at,fromtag:$fromtag" | pipe_o` + echo "lookup $callid $dst:audio $gw voip.inode.at local unknown unknown unknown-agent info=domain:voip.sipwise.local,from:number@voip.inode.at,totag:$totag,to:othernumber@voip.inode.at,fromtag:$fromtag" | pipe + echo version | pipe + echo status | pipe + + echo foo > /dev/udp/${src_rel/ //} + echo bar > /dev/udp/${dst_rel/ //} + + ids="$ids $callid" +done + +sleep 10 + +for id in $ids; do + echo "delete $id info=" | pipe +done