From 14262f56fa4c0c1aaed4db704c46a82554bfaf96 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Tue, 20 Feb 2018 11:18:39 -0500 Subject: [PATCH] fix segfault regression from e84fd86 closes #470 Change-Id: I3ce83e4fdc5fe8113932bb51ec3375c6144814ae --- daemon/call.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/daemon/call.c b/daemon/call.c index 56ae9b511..ed74acdcc 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -931,7 +931,7 @@ enum call_stream_state call_stream_state_machine(struct packet_stream *ps) { if (MEDIA_ISSET(media, DTLS)) { mutex_lock(&ps->in_lock); struct stream_fd *sfd = dtls_sfd(ps); - if (sfd->dtls.init && !sfd->dtls.connected) { + if (sfd && sfd->dtls.init && !sfd->dtls.connected) { dtls(sfd, NULL, NULL); mutex_unlock(&ps->in_lock); return CSS_DTLS; @@ -952,7 +952,7 @@ void call_media_state_machine(struct call_media *m) { static int __init_stream(struct packet_stream *ps) { struct call_media *media = ps->media; struct call *call = ps->call; - int active; + int active = -1; if (MEDIA_ISSET(media, SDES)) { for (GList *l = ps->sfds.head; l; l = l->next) { @@ -964,7 +964,8 @@ static int __init_stream(struct packet_stream *ps) { if (MEDIA_ISSET(media, DTLS) && !PS_ISSET(ps, FALLBACK_RTCP)) { struct stream_fd *sfd = dtls_sfd(ps); - active = dtls_is_active(&sfd->dtls); + if (sfd) + active = dtls_is_active(&sfd->dtls); // we try to retain our role if possible, but must handle a role switch if ((active && !MEDIA_ISSET(media, SETUP_ACTIVE)) || (!active && !MEDIA_ISSET(media, SETUP_PASSIVE)))