[OpenSIPS-Devel] [opensips] Modparam string not duplicated when USE_FUNC_PARAM flag set (#349)

miko95 notifications at github.com
Sun Oct 5 09:34:58 CEST 2014


Hi,

Don't know how much it is important but it's worth looking at it.

Regarding the following block (modparam.c around line 88):

```
if (param->type&USE_FUNC_PARAM) {
	n = ((param_func_t)(param->param_pointer))(type, val );
	if (n<0)
		return -4;
} else {
	switch(type) {
		case STR_PARAM:
			*((char**)(param->param_pointer)) = strdup((char*)val);
			break;
		case INT_PARAM:
			*((int*)(param->param_pointer)) = (int)(long)val;
			break;
	}
}
```
When the USE_FUNC_PARAM flag is set, and the module parameter type is STR_PARAM, the actual string is not duplicated before it is passed to the function.
However, it is duplicated if only the STR_PARAM flag is set.
The string is allocated in the parser code but I don't know if it deallocated after parsing is done, in which case not duplicating it may be a problem.

Regards,
Mickael

---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/issues/349
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/devel/attachments/20141005/ac7424b8/attachment.htm>


More information about the Devel mailing list