Module: kamailio
Branch: 5.4
Commit: 48df37a27ae2e42498d1cb44bec8604827a5ed55
URL:
https://github.com/kamailio/kamailio/commit/48df37a27ae2e42498d1cb44bec8604…
Author: Alex Hermann <alex(a)hexla.nl>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-10-23T10:58:09+02:00
janssonrpcc: cleanups (#2512)
* janssonrpcc: Remove unused variable and redundant assignment
* janssonrpc: No need for copying options
The address stay valid until free_params is called. And before that
happens, mod_jsonrpc_request() makes its own copy.
(cherry picked from commit 61771b0595c126d884e8c1eb392a54b5786a8fa8)
---
Modified: src/modules/janssonrpcc/janssonrpc_funcs.c
---
Diff:
https://github.com/kamailio/kamailio/commit/48df37a27ae2e42498d1cb44bec8604…
Patch:
https://github.com/kamailio/kamailio/commit/48df37a27ae2e42498d1cb44bec8604…
---
diff --git a/src/modules/janssonrpcc/janssonrpc_funcs.c
b/src/modules/janssonrpcc/janssonrpc_funcs.c
index 93e62bd53d..70b3e9413e 100644
--- a/src/modules/janssonrpcc/janssonrpc_funcs.c
+++ b/src/modules/janssonrpcc/janssonrpc_funcs.c
@@ -44,7 +44,6 @@ int jsonrpc_request(struct sip_msg* _m,
str params;
str options;
str route;
- param_hooks_t phooks;
param_t* pit=NULL;
param_t* freeme=NULL;
int retry;
@@ -85,7 +84,7 @@ int jsonrpc_request(struct sip_msg* _m,
options.len--;
}
- if (parse_params(&options, CLASS_ANY, &phooks, &pit)<0) {
+ if (parse_params(&options, CLASS_ANY, NULL, &pit)<0) {
ERR("failed parsing params value\n");
return -1;
}
@@ -95,8 +94,7 @@ int jsonrpc_request(struct sip_msg* _m,
for (; pit;pit=pit->next)
{
if PIT_MATCHES("route") {
- pkg_str_dup(&route, &pit->body);
- CHECK_MALLOC_GOTO(route.s, end);
+ route = pit->body;
} else if PIT_MATCHES("timeout") {
timeout = atoi(pit->body.s);
@@ -123,8 +121,6 @@ int jsonrpc_request(struct sip_msg* _m,
goto end;
}
- retval = 0;
-
retval = mod_jsonrpc_request(
_m, /* sip_msg */
conn, /* connection group */
@@ -138,7 +134,6 @@ int jsonrpc_request(struct sip_msg* _m,
end:
if(freeme) free_params(freeme);
- if(route.s) pkg_free(route.s);
return retval;
}