From 0b0f5fff65e28fe815648644a13b12eace15c255 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Tue, 6 Apr 2021 20:00:13 +0300 Subject: [PATCH] [mod_sofia] Cleanup sofia_glue_get_host() and make the pool arg be required. --- src/mod/endpoints/mod_sofia/sofia_glue.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 1f2afef85c..c00c439600 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -3454,17 +3454,15 @@ char *sofia_glue_get_host(const char *str, switch_memory_pool_t *pool) { char *s, *p; + switch_assert(pool != NULL); + if ((p = strchr(str, '@'))) { p++; } else { return NULL; } - if (pool) { - s = switch_core_strdup(pool, p); - } else { - s = strdup(p); - } + s = switch_core_strdup(pool, p); for (p = s; p && *p; p++) { if ((*p == ';') || (*p == '>')) {