### Description
when call detailed_ipv4_type function, pkg memory leak. ```c detailed_ipv4_type($si,"$var(iptype)"); ```
### Troubleshooting
#### Reproduction just call detailed_ipv4_type function.
#### Debugging Data
``` ALERT: qm_sums: qm_sums(): count= 48161 size= 1789640 bytes from core: core/rvalue.c: rval_get_str(1293)
```
### Possible Solutions
ip address string not free in rval_get_str() function. [s->s=pkg_malloc(tmp.len+1/* 0 term */);](https://github.com/kamailio/kamailio/blob/1ddc27f199061025a6a43da3e8a1388fca...) need call pkg_free() free memory.
### Additional Information test 3 version. ``` kamailio 5.5.4 kamailio 5.4.8 kamailio 5.3.9 ```
* **Operating System**: ``` buster 10 ubuntu 20.04 ```
I haven't implemented this function and didn't dig in the code, but knowing that it comes from Kamailio branch and mostly the SER-originated functions support parameters as expressions with variables, I would say to try the Kamailio style with variables inside string, like:
``` detailed_ipv4_type("$si", "$var(iptype)"); ```
Probably we would need to catch such cases if they cause issues.
kamailio 5.3.9, ubuntu 20.04
kamailio 5.3.9, ubuntu 20.04
kamailio.cfg
```c debug=-1 log_stderror=no
memdbg=5 memlog=5 log_facility=LOG_LOCAL0 log_prefix="{$mt $hdr(CSeq) $ci} " mpath="/usr/local/lib64/kamailio/modules/" children=1 listen=udp:172.29.156.216:5060
loadmodule "jsonrpcs.so" loadmodule "kex.so" loadmodule "corex.so" loadmodule "tm.so" loadmodule "tmx.so" loadmodule "sl.so" loadmodule "rr.so" loadmodule "pv.so" loadmodule "maxfwd.so" loadmodule "textops.so" loadmodule "siputils.so" loadmodule "xlog.so" loadmodule "sanity.so" loadmodule "ctl.so" loadmodule "cfg_rpc.so" loadmodule "counters.so" loadmodule "ipops.so"
modparam("jsonrpcs", "pretty_format", 1) modparam("ctl", "binrpc", "unix:/run/kamailio/kamailio_ctl") modparam("tm", "failure_reply_mode", 3) modparam("tm", "fr_timer", 30000) modparam("tm", "fr_inv_timer", 120000) modparam("rr", "enable_full_lr", 0) modparam("rr", "append_fromtag", 0)
request_route { detailed_ipv4_type($si,"$var(iptype)"); xlog("L_INFO", "$var(iptype)\n"); exit; } ```
before pkg.stats ```c { entry: 1 pid: 13353 rank: 1 used: 464704 free: 7617928 real_used: 770680 total_size: 8388608 total_frags: 4 } ```
run sipp
after pkg.stats ```c { entry: 1 pid: 13353 rank: 1 used: 598984 free: 6610880 real_used: 1777728 total_size: 8388608 total_frags: 17 } ```
As I said in my previous comment, try with the format having all parameters in the quotes, respectively use:
``` detailed_ipv4_type("$si", "$var(iptype)"); ```
The `$si` has to be between double quotes.
$si between double quotes, works for me. thank you.
Closed #3159 as completed.