Skip to content

Commit

Permalink
presence: fix multiple double free on shutdown caught with memlog=1
Browse files Browse the repository at this point in the history
  • Loading branch information
Dragos Oancea committed Aug 19, 2016
1 parent cfb806e commit dc6962f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions modules/presence/hash.c
Expand Up @@ -101,6 +101,7 @@ void destroy_shtable(shtable_t htable, int hash_size)
lock_destroy(&htable[i].lock);
free_subs_list(htable[i].entries->next, SHM_MEM_TYPE, 1);
shm_free(htable[i].entries);
htable[i].entries = NULL;
}
shm_free(htable);
htable= NULL;
Expand Down Expand Up @@ -345,15 +346,21 @@ void free_subs_list(subs_t* s_array, int mem_type, int ic)
s_array= s_array->next;
if(mem_type & PKG_MEM_TYPE)
{
if(ic)
if(ic) {
pkg_free(s->contact.s);
s->contact.s = NULL;
}
pkg_free(s);
s = NULL;
}
else
{
if(ic)
if(ic) {
shm_free(s->contact.s);
s->contact.s = NULL;
}
shm_free(s);
s = NULL;
}
}

Expand Down

0 comments on commit dc6962f

Please sign in to comment.