From aaff8863aba8a681aeb1b4b536f008690ae5e7a2 Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Thu, 5 Jan 2023 14:14:50 +0100 Subject: [PATCH] MT#56126 Fix a defect noticed by Cov.Scan (introduced by: 8595f95) 1872 /* first add those mentioned in the order list, 1873 * but only, if they were previously generated/added to the sdes_out */ >>> CID 1530346: Control flow issues (DEADCODE) >>> Execution cannot reach the expression "NULL" inside this statement: "l = (cpq_order ? cpq_order-...". 1874 for (GList *l = cpq_order ? cpq_order->head : NULL; l; l = l->next) Change-Id: I58f84ba82d215a9eb6cbd97548e8e9e8a954bdc6 --- daemon/call.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/daemon/call.c b/daemon/call.c index ac7b49917..84e65183a 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -1688,13 +1688,12 @@ static void __generate_crypto(const struct sdp_ng_flags *flags, struct call_medi GQueue *cpq_in = &this->sdes_in; const GQueue *offered_cpq = other ? &other->sdes_in : NULL; + if (!flags) + return; /* requested order of crypto suites */ const GQueue *cpq_order = &flags->sdes_order; - if (!flags) - return; - bool is_offer = (flags->opmode == OP_OFFER || flags->opmode == OP_REQUEST); if (!this->protocol || !this->protocol->srtp || MEDIA_ISSET(this, PASSTHRU)) { @@ -1871,7 +1870,7 @@ static void __generate_crypto(const struct sdp_ng_flags *flags, struct call_medi /* first add those mentioned in the order list, * but only, if they were previously generated/added to the sdes_out */ - for (GList *l = cpq_order ? cpq_order->head : NULL; l; l = l->next) + for (GList *l = cpq_order->head; l; l = l->next) { str * cs_name = l->data; struct crypto_params_sdes * cps_order;