From 98512e015246560609837a10f28c591fa9e6d73d Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Thu, 14 May 2026 20:06:25 +0200 Subject: [PATCH] MT#61856 call_flags: reorder guards in `ng_sdp_attr_manipulations_iter()` First check if the given `command_action` is a dict, and only then allocate manipulation object. Because otherwise it still creates an object, but then if the `command_action` isn't a dict, it just returns. So useless. Hence re-order them. Change-Id: I50bd334d8b945a5dd5177202168ef21cf2915458 --- daemon/call_flags.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/daemon/call_flags.c b/daemon/call_flags.c index 06afd173b..b9e71f312 100644 --- a/daemon/call_flags.c +++ b/daemon/call_flags.c @@ -210,6 +210,11 @@ static const char *ng_sdp_attr_media_iter(const ng_parser_t *parser, str *comman static const char *ng_sdp_attr_manipulations_iter(const ng_parser_t *parser, str *media_type, parser_arg command_action, helper_arg arg) { + if (!parser->is_dict(command_action)) { + ilog(LOG_WARN, "SDP manipulations: Wrong content for SDP section."); + return "wrong content given"; + } + struct sdp_manipulations *sm = sdp_manipulations_get_by_name(arg.flags->sdp_manipulations, media_type); if (!sm) { ilog(LOG_WARN, "SDP manipulations: unsupported SDP section '" STR_FORMAT "' targeted.", @@ -217,11 +222,6 @@ static const char *ng_sdp_attr_manipulations_iter(const ng_parser_t *parser, str return "unsupported sdp section"; } - if (!parser->is_dict(command_action)) { - ilog(LOG_WARN, "SDP manipulations: Wrong content for SDP section."); - return "wrong content given"; - } - return parser->dict_iter(parser, command_action, ng_sdp_attr_media_iter, sm); } INLINE const char *ng_sdp_attr_manipulations(const ng_parser_t *parser, sdp_ng_flags *flags, parser_arg value) {