|
@@ -241,6 +241,7 @@ void subs_cback_func(struct cell *t, int cb_type, struct tmcb_params *ps)
|
|
int initial_request = 0;
|
|
int initial_request = 0;
|
|
db1_res_t *res=NULL;
|
|
db1_res_t *res=NULL;
|
|
ua_pres_t dbpres;
|
|
ua_pres_t dbpres;
|
|
|
|
+ int need_to_free=0;
|
|
str pres_uri={0,0}, watcher_uri={0,0}, extra_headers={0,0};
|
|
str pres_uri={0,0}, watcher_uri={0,0}, extra_headers={0,0};
|
|
|
|
|
|
memset(&dbpres, 0, sizeof(dbpres));
|
|
memset(&dbpres, 0, sizeof(dbpres));
|
|
@@ -563,7 +564,7 @@ void subs_cback_func(struct cell *t, int cb_type, struct tmcb_params *ps)
|
|
size= sizeof(ua_pres_t)+ 2*sizeof(str)+( pto->uri.len+
|
|
size= sizeof(ua_pres_t)+ 2*sizeof(str)+( pto->uri.len+
|
|
pfrom->uri.len+ pto->tag_value.len+ pfrom->tag_value.len
|
|
pfrom->uri.len+ pto->tag_value.len+ pfrom->tag_value.len
|
|
+msg->callid->body.len+ record_route.len+ hentity->contact.len+
|
|
+msg->callid->body.len+ record_route.len+ hentity->contact.len+
|
|
- hentity->id.len )*sizeof(char);
|
|
|
|
|
|
+ hentity->id.len + contact.len)*sizeof(char);
|
|
|
|
|
|
if(hentity->extra_headers)
|
|
if(hentity->extra_headers)
|
|
size+= sizeof(str)+ hentity->extra_headers->len*sizeof(char);
|
|
size+= sizeof(str)+ hentity->extra_headers->len*sizeof(char);
|
|
@@ -576,6 +577,11 @@ void subs_cback_func(struct cell *t, int cb_type, struct tmcb_params *ps)
|
|
pkg_free(record_route.s);
|
|
pkg_free(record_route.s);
|
|
goto done;
|
|
goto done;
|
|
}
|
|
}
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ need_to_free=1;
|
|
|
|
+ }
|
|
|
|
+
|
|
memset(presentity, 0, size);
|
|
memset(presentity, 0, size);
|
|
size= sizeof(ua_pres_t);
|
|
size= sizeof(ua_pres_t);
|
|
|
|
|
|
@@ -647,13 +653,10 @@ void subs_cback_func(struct cell *t, int cb_type, struct tmcb_params *ps)
|
|
}
|
|
}
|
|
|
|
|
|
/* write the remote contact filed */
|
|
/* write the remote contact filed */
|
|
- presentity->remote_contact.s= (char*)shm_malloc(contact.len* sizeof(char));
|
|
|
|
- if(presentity->remote_contact.s== NULL)
|
|
|
|
- {
|
|
|
|
- ERR_MEM(SHARE_MEM);
|
|
|
|
- }
|
|
|
|
|
|
+ presentity->remote_contact.s= (char*)presentity+ size;
|
|
memcpy(presentity->remote_contact.s, contact.s, contact.len);
|
|
memcpy(presentity->remote_contact.s, contact.s, contact.len);
|
|
presentity->remote_contact.len= contact.len;
|
|
presentity->remote_contact.len= contact.len;
|
|
|
|
+ size+= presentity->remote_contact.len;
|
|
|
|
|
|
presentity->event|= hentity->event;
|
|
presentity->event|= hentity->event;
|
|
presentity->flag= hentity->flag;
|
|
presentity->flag= hentity->flag;
|
|
@@ -688,7 +691,10 @@ error:
|
|
if (dbmode == PUA_DB_ONLY)
|
|
if (dbmode == PUA_DB_ONLY)
|
|
{
|
|
{
|
|
if (presentity!=NULL)
|
|
if (presentity!=NULL)
|
|
|
|
+ {
|
|
delete_temporary_dialog_puadb(presentity);
|
|
delete_temporary_dialog_puadb(presentity);
|
|
|
|
+ if (need_to_free) shm_free(presentity);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
@@ -1082,6 +1088,7 @@ insert:
|
|
if (dbmode==PUA_DB_ONLY)
|
|
if (dbmode==PUA_DB_ONLY)
|
|
{
|
|
{
|
|
insert_puadb(presentity);
|
|
insert_puadb(presentity);
|
|
|
|
+ shm_free(presentity);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|