]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-11903: Fix errors reported by PVS-Studio Static Code Analyzer for mod_rayo
authorAndrey Volk <andywolk@gmail.com>
Fri, 12 Jul 2019 15:54:29 +0000 (19:54 +0400)
committerAndrey Volk <andywolk@gmail.com>
Mon, 15 Jul 2019 19:39:28 +0000 (23:39 +0400)
src/mod/event_handlers/mod_rayo/iks_helpers.c
src/mod/event_handlers/mod_rayo/mod_rayo.c
src/mod/event_handlers/mod_rayo/nlsml.c
src/mod/event_handlers/mod_rayo/rayo_cpa_component.c

index 707350a97d574ce8ec16caecdc4f066b8b7b5f81..2f293aabb735d07b3c34d4d40fd1671cc5a4155f 100644 (file)
@@ -396,7 +396,7 @@ int iks_attrib_is_decimal_between_zero_and_one(const char *value)
 {
        if (value && *value && switch_is_number(value)) {
                double value_d = atof(value);
-               if (value_d >= 0.0 || value_d <= 1.0) {
+               if (value_d >= 0.0 && value_d <= 1.0) {
                        return SWITCH_TRUE;
                }
        }
index 9ef5b8c91372c30ac9173c30e7c74bcace9fa61c..25ab87b97586df20a6934d13c35293160afc1801 100644 (file)
@@ -912,6 +912,7 @@ void rayo_message_send(struct rayo_actor *from, const char *to, iks *payload, in
 {
        const char *msg_name;
        struct rayo_message *msg = malloc(sizeof(*msg));
+       switch_assert(msg);
        if (dup) {
                msg->payload = iks_copy(payload);
        } else {
index 752ddc3efa44a8409d58cc4cb7d7b6cb46ed9892..732687900db008899f10af154f537475fe6d2e70 100644 (file)
@@ -271,6 +271,7 @@ static int tag_hook(void *user_data, char *name, char **atts, int type)
 
        if (type == IKS_OPEN || type == IKS_SINGLE) {
                struct nlsml_node *child_node = malloc(sizeof(*child_node));
+               switch_assert(child_node);
                child_node->name = name;
                child_node->tag_def = switch_core_hash_find(globals.tag_defs, name);
                if (!child_node->tag_def) {
index 19f2ddafd76613ae467349166905bf6c9b36a4f6..15dcd74aa7936d8ca02c51f54b5d0329f348b749 100644 (file)
@@ -310,6 +310,7 @@ iks *rayo_cpa_component_start(struct rayo_actor *call, struct rayo_message *msg,
                        have_grammar = 1;
 
                        url_dup = strdup(url);
+                       switch_assert(url_dup);
                        if ((url_params = strchr(url_dup, '?'))) {
                                *url_params = '\0';
                                url_params++;