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

tls_mgm: don't free anything in mod_destroy() #3269

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 6 additions & 23 deletions modules/tls_mgm/tls_mgm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1171,29 +1171,12 @@ static int child_init(int rank)

static void mod_destroy(void)
{
struct tls_domain *d, *d_tmp;

if (dom_lock)
lock_destroy_rw(dom_lock);

d = *tls_server_domains;
while (d) {
d_tmp = d;
d = d->next;
tls_free_domain(d_tmp);
}
d = *tls_client_domains;
while (d) {
d_tmp = d;
d = d->next;
tls_free_domain(d_tmp);
}

shm_free(tls_server_domains);
shm_free(tls_client_domains);

map_destroy(server_dom_matching, map_free_node);
map_destroy(client_dom_matching, map_free_node);
/* XXX: this function used to free the domains, but that is not safe because
* the TCP connections can still have references to them, which will be
* dangling pointers, leading to a double-free, when mod_destroy() is called
* in the process of shutting down. Better just not to free anything in here.
* https://github.com/OpenSIPS/opensips/pull/3281
* */
}

static int list_domain(mi_item_t *domains_arr, struct tls_domain *d)
Expand Down
Loading