Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

registrar: added new parameter sock_addr #2498

Merged
merged 5 commits into from Oct 14, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 4 additions & 33 deletions src/modules/registrar/save.c
Expand Up @@ -229,8 +229,8 @@ static inline ucontact_info_t* pack_ci( struct sip_msg* _m, contact_t* _c,
static int received_found;
static unsigned int allowed, allow_parsed;
static struct sip_msg *m = 0;
static struct socket_info si = {0};
int_str val;
struct socket_info *si = 0;

if (_m!=0) {
memset( &ci, 0, sizeof(ucontact_info_t));
Expand All @@ -254,16 +254,9 @@ static inline ucontact_info_t* pack_ci( struct sip_msg* _m, contact_t* _c,

/* set received socket */
if (sock_addr.len>0) {
si = (struct socket_info *)pkg_malloc(sizeof(struct socket_info));
if(si == 0) {
LOG(L_ERR, "ERROR: pack_ci: memory allocation error\n");
rerrno = R_PARSE;
goto error;
}

memset(si, 0, sizeof(struct socket_info));
si->sock_str = sock_addr;
ci.sock = si;
memset(&si, 0, sizeof(struct socket_info));
si.sock_str = sock_addr;
ci.sock = &si;
} else if (_m->flags&sock_flag) {
ci.sock = get_sock_val(_m);
if (ci.sock==0)
Expand Down Expand Up @@ -425,10 +418,6 @@ static inline ucontact_info_t* pack_ci( struct sip_msg* _m, contact_t* _c,
return &ci;
error:

if (si) {
pkg_free(si);
}

return 0;
}

Expand Down Expand Up @@ -577,11 +566,6 @@ static inline int insert_contacts(struct sip_msg* _m, udomain_t* _d, str* _a, in
build_contact(_m, NULL, &u->host);
}

if (sock_addr.len>0 && ci && ci->sock) {
pkg_free(ci->sock);
}


#ifdef USE_TCP
if ( tcp_check && e_max>0 ) {
e_max -= act_time;
Expand All @@ -595,11 +579,6 @@ static inline int insert_contacts(struct sip_msg* _m, udomain_t* _d, str* _a, in
if (r)
ul.delete_urecord(_d, _a, r);

if (sock_addr.len>0 && ci && ci->sock) {
pkg_free(ci->sock);
}


return -1;
}

Expand Down Expand Up @@ -842,17 +821,9 @@ static inline int update_contacts(struct sip_msg* _m, urecord_t* _r, int _mode,
}
#endif

if (sock_addr.len>0 && ci && ci->sock) {
pkg_free(ci->sock);
}

return rc;
error:

if (sock_addr.len>0 && ci && ci->sock) {
pkg_free(ci->sock);
}

return -1;
}

Expand Down