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
mr26.1
Donat Zenichev 1 month ago
parent a7b24c955c
commit 98512e0152

@ -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) {

Loading…
Cancel
Save