Browse code

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.

Alex Hermann authored on 20/10/2020 08:40:28
Showing 1 changed files
... ...
@@ -94,8 +94,7 @@ int jsonrpc_request(struct sip_msg* _m,
94 94
 		for (; pit;pit=pit->next)
95 95
 		{
96 96
 			if PIT_MATCHES("route") {
97
-				pkg_str_dup(&route, &pit->body);
98
-				CHECK_MALLOC_GOTO(route.s, end);
97
+				route = pit->body;
99 98
 
100 99
 			} else if PIT_MATCHES("timeout") {
101 100
 				timeout = atoi(pit->body.s);
... ...
@@ -135,7 +134,6 @@ skip_parse:
135 134
 
136 135
 end:
137 136
 	if(freeme) free_params(freeme);
138
-	if(route.s) pkg_free(route.s);
139 137
 	return retval;
140 138
 }
141 139