Skip to content

Commit

Permalink
tls_mgm: properly free TLS domain when failing to initialize it
Browse files Browse the repository at this point in the history
  • Loading branch information
rvlad-patrascu committed Dec 2, 2021
1 parent d9e6ac3 commit 8af30c0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions modules/tls_mgm/tls_domain.c
Expand Up @@ -116,6 +116,9 @@ void tls_free_domain(struct tls_domain *dom)

dom->refs--;
if (dom->refs == 0) {
LM_DBG("Freeing domain: %.*s\n",
tls_domain->name.len, tls_domain->name.s);

destroy_tls_dom(dom);

lock_destroy(dom->lock);
Expand Down
4 changes: 2 additions & 2 deletions modules/tls_mgm/tls_mgm.c
Expand Up @@ -705,7 +705,7 @@ static int init_tls_domains(struct tls_domain **dom)

tmp = d;
d = d->next;
destroy_tls_dom(tmp);
tls_free_domain(tmp);

if (!db)
return -1;
Expand Down Expand Up @@ -755,7 +755,7 @@ static int init_tls_domains(struct tls_domain **dom)

tmp = d;
d = d->next;
destroy_tls_dom(tmp);
tls_free_domain(tmp);

if (!db)
return -1;
Expand Down

0 comments on commit 8af30c0

Please sign in to comment.