diff --git a/daemon/call.c b/daemon/call.c index 26949ba99..a73a00ec9 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -2675,13 +2675,11 @@ static void __call_monologue_init_from_flags(struct call_monologue *ml, struct c (!ml->sdp_session_name || /* if not set yet */ (ml->sdp_session_name && !flags->replace_sess_name))) /* replace_sess_name = do not replace if possible*/ { - ml->sdp_session_name = call_strdup_len(flags->session_sdp_name.s, - flags->session_sdp_name.len); + ml->sdp_session_name = call_strdup_str(&flags->session_sdp_name); } /* sdp session timing */ if (flags->session_timing.len) - ml->sdp_session_timing = call_strdup_len(flags->session_timing.s, - flags->session_timing.len); + ml->sdp_session_timing = call_strdup_str(&flags->session_timing); /* sdp bandwidth per session level * 0 value is supported (e.g. b=RR:0 and b=RS:0), to be able to disable rtcp */ ml->sdp_session_bandwidth.as = flags->session_bandwidth.as; @@ -2691,8 +2689,7 @@ static void __call_monologue_init_from_flags(struct call_monologue *ml, struct c ml->sdp_session_bandwidth.tias = flags->session_bandwidth.tias; /* sdp session group */ if (flags->session_group.len) - ml->sdp_session_group = call_strdup_len(flags->session_group.s, - flags->session_group.len); + ml->sdp_session_group = call_strdup_str(&flags->session_group); } // reset offer ipv4/ipv6/mixed media stats diff --git a/daemon/redis.c b/daemon/redis.c index 9b4df63d3..6232953f9 100644 --- a/daemon/redis.c +++ b/daemon/redis.c @@ -1490,10 +1490,10 @@ static int redis_tags(call_t *c, struct redis_list *tags, parser_arg arg) { /* s= */ if (!redis_hash_get_str(&s, rh, "sdp_session_name")) - ml->sdp_session_name = call_strdup_len(s.s, s.len); + ml->sdp_session_name = call_strdup_str(&s); /* t= */ if (!redis_hash_get_str(&s, rh, "sdp_session_timing")) - ml->sdp_session_timing = call_strdup_len(s.s, s.len); + ml->sdp_session_timing = call_strdup_str(&s); /* o= */ if (!redis_hash_get_str(&s, rh, "sdp_orig_parsed")) { ml->session_sdp_orig = g_slice_alloc0(sizeof(*ml->session_sdp_orig)); diff --git a/include/call.h b/include/call.h index cd7eb9b2f..22e28e623 100644 --- a/include/call.h +++ b/include/call.h @@ -880,6 +880,11 @@ INLINE char *call_strdup(const char *s) { return NULL; return call_strdup_len(s, strlen(s)); } +INLINE char *call_strdup_str(const str *s) { + if (!s) + return NULL; + return call_strdup_len(s->s, s->len); +} INLINE str call_str_cpy_len(const char *in, size_t len) { str out; if (!in) {