MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / clone_proxy

Function clone_proxy

proxy.c:330–362  ·  view source on GitHub ↗

clones a proxy into pkg memory */

Source from the content-addressed store, hash-verified

328
329/* clones a proxy into pkg memory */
330struct proxy_l* clone_proxy(struct proxy_l *sp)
331{
332 struct proxy_l *dp;
333
334 dp = (struct proxy_l*)pkg_malloc(sizeof(struct proxy_l));
335 if (dp==NULL) {
336 LM_ERR("no more pkg memory\n");
337 return 0;
338 }
339 memset( dp , 0 , sizeof(struct proxy_l));
340
341 dp->port = sp->port;
342 dp->proto = sp->proto;
343 dp->addr_idx = sp->addr_idx;
344
345 /* clone the hostent */
346 if (hostent_cpy( &dp->host, &sp->host)!=0)
347 goto error0;
348
349 /* clone the dns resolver */
350 if (sp->dn) {
351 dp->dn = dns_res_copy(sp->dn);
352 if (dp->dn==NULL)
353 goto error1;
354 }
355
356 return dp;
357error1:
358 free_hostent(&dp->host);
359error0:
360 pkg_free(dp);
361 return 0;
362}
363
364

Callers 3

w_forwardFunction · 0.85
w_sendFunction · 0.85
w_t_relayFunction · 0.85

Calls 3

hostent_cpyFunction · 0.85
dns_res_copyFunction · 0.85
free_hostentFunction · 0.85

Tested by

no test coverage detected