Hi,

I'm seeing a possible leak in parsing the P-Asserted-Identity, and possibly P-Preferred-Identity headers in kamailio-3.3.4.

I have a server running in which one thread has currently most of the 8 MB private memory allocated. At restart qm_sums reports parse_pai.c as sitting on most of the memory:

Apr 16 16:38:58 gws1 /usr/sbin/kamailio[9398]: INFO: qm_status: heap size= 8388608
Apr 16 16:38:58 gws1 /usr/sbin/kamailio[9398]: INFO: qm_status: used= 5369240, used+overhead=6417216, free=1971392
[...]
Apr 16 16:39:03 gws1 /usr/sbin/kamailio[9398]: INFO: qm_sums:  count=  6198 size=   4721776 bytes from <core>: parse_pai.c: parse_pai_header(58)

I am currently using the header through $ai for xlog statements, the accounting module and a validity check (if (!($(ai{uri.user}) =~ "^\+[1-9]+")) {...}).

From digging through the logs it could seem like this happens when using $ai in the accounting module. I'll try removing it from accounting (log_extra) and see if it stops leaking.

--
Tais Plougmann Hansen

OSD Consulting ApS
osd.dk
Tel: +45 78101078
CVR: DK31332737