Browse Source

MT#61368 improve media finding logic

Avoids a potential null dereference as well

Change-Id: I177f6f6e11b2c24ff49a8fca88121513f764dbe4
Warned-by: Coverity
pull/1897/head
Richard Fuchs 12 months ago
parent
commit
78191d9216
1 changed files with 9 additions and 11 deletions
  1. +9
    -11
      daemon/call.c

+ 9
- 11
daemon/call.c View File

@ -3062,19 +3062,17 @@ int monologue_offer_answer(struct call_monologue *monologues[2], sdp_streams_q *
for (auto_iter(l, sender_media->media_subscriptions.head); l && !receiver_media; l = l->next) {
__auto_type ms = l->data;
__auto_type r_media = ms->media;
if (!r_media)
continue;
if (r_media->monologue != receiver_ml)
continue;
if (r_media) {
// check type, it must match
if (str_cmp_str(&r_media->type, &sender_media->type))
continue;
}
if (r_media) {
// check a=mid, it must match if present
if (sender_media->media_id.len && r_media->media_id.len
&& str_cmp_str(&sender_media->media_id, &r_media->media_id))
continue;
}
// check type, it must match
if (str_cmp_str(&r_media->type, &sender_media->type))
continue;
// check a=mid, it must match if present
if (sender_media->media_id.len && r_media->media_id.len
&& str_cmp_str(&sender_media->media_id, &r_media->media_id))
continue;
// found it
receiver_media = r_media;
}


Loading…
Cancel
Save