Skip to content

Commit

Permalink
MT#57719 Fix defect spotted by Coverity Scan (85fc7ff)
Browse files Browse the repository at this point in the history
*** CID 1570963:  Null pointer dereferences  (REVERSE_INULL)
/daemon/call.c: 3553 in monologue_subscribe_answer()
3547     		/* set src_media based on subscription (assuming it is one-to-one) */
3548     		struct call_media * dst_media = __get_media(dst_ml, sp, flags, 0);
3549     		GList * src_ml_media_it = dst_media->media_subscriptions.head;
3550     		struct media_subscription * ms = src_ml_media_it->data;
3551     		struct call_media * src_media = ms->media;
3552
>>>     CID 1570963:  Null pointer dereferences  (REVERSE_INULL)
>>>     Null-checking "dst_media" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
3553     		if (!dst_media || !src_media)
3554     			continue;
3555
3556     		/* additional attributes to be carried for `sdp_create()` */
3557     		if (print_extra_sess_attrs && !g_queue_find(&attr_mls, ms->monologue)) {
3558     			sdp_copy_session_attributes(ms->monologue, dst_ml);

Change-Id: I391b95f61237e5a7af206b0568a1cf421dcbb8f8
  • Loading branch information
zenichev committed Nov 13, 2023
1 parent 6a792f2 commit da13484
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions daemon/call.c
Original file line number Diff line number Diff line change
Expand Up @@ -3413,16 +3413,19 @@ int monologue_subscribe_answer(struct call_monologue *dst_ml, struct sdp_ng_flag
for (GList * l = streams->head; l; l = l->next)
{
struct stream_params * sp = l->data;
struct call_media * dst_media = __get_media(dst_ml, sp, flags, 0);

if (!dst_media)
continue;

/* set src_media based on subscription (assuming it is one-to-one)
* TODO: this should probably be reworked to support one-to-multi subscriptions.
*/
struct call_media * dst_media = __get_media(dst_ml, sp, flags, 0);
GList * src_ml_media_it = dst_media->media_subscriptions.head;
struct media_subscription * ms = src_ml_media_it->data;
struct call_media * src_media = ms->media;

if (!dst_media || !src_media)
if (!src_media)
continue;

/* additional attributes to be carried for `sdp_create()` */
Expand Down

0 comments on commit da13484

Please sign in to comment.