Skip to content

Commit

Permalink
pua: convert to memory logging helper, add missing log message and me…
Browse files Browse the repository at this point in the history
…m error handling
  • Loading branch information
pantelisk98 authored and henningw committed Apr 29, 2023
1 parent 8992729 commit b1a4774
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/modules/pua/hash.c
Expand Up @@ -229,6 +229,9 @@ void update_htable(ua_pres_t* p, time_t desired_expires, int expires,
if(p->remote_contact.s== NULL)
{
SHM_MEM_ERROR;
if(etag) {
shm_free(p->etag.s);
}
return;
}
memcpy(p->remote_contact.s, contact->s, contact->len);
Expand Down
3 changes: 3 additions & 0 deletions src/modules/pua/pua.c
Expand Up @@ -601,6 +601,9 @@ static int db_restore(void)
if(p->etag.s== NULL)
{
SHM_MEM_ERROR;
if(watcher_uri.s && watcher_uri.len) {
shm_free(p->remote_contact.s);
}
goto error;
}
memcpy(p->etag.s, etag.s, etag.len);
Expand Down
1 change: 1 addition & 0 deletions src/modules/pua/send_publish.c
Expand Up @@ -409,6 +409,7 @@ void publ_cback_func(struct cell *t, int type, struct tmcb_params *ps)
if(presentity->etag.s== NULL)
{
SHM_MEM_ERROR;
shm_free(presentity);
goto error;
}
memcpy(presentity->etag.s, etag.s, etag.len);
Expand Down
4 changes: 3 additions & 1 deletion src/modules/pua/send_subscribe.c
Expand Up @@ -654,7 +654,9 @@ void subs_cback_func(struct cell *t, int cb_type, struct tmcb_params *ps)
presentity->remote_contact.s= (char*)shm_malloc(contact.len* sizeof(char));
if(presentity->remote_contact.s==NULL)
{
ERR_MEM(SHARE_MEM);
SHM_MEM_ERROR;
shm_free(presentity);
return;
}
memcpy(presentity->remote_contact.s, contact.s, contact.len);
presentity->remote_contact.len= contact.len;
Expand Down

0 comments on commit b1a4774

Please sign in to comment.