FS-11903: Fix errors reported by PVS-Studio Static Code Analyzer for mod_rayo

This commit is contained in:
Andrey Volk 2019-07-12 19:54:29 +04:00
parent 7afec393c7
commit f4c9048e24
4 changed files with 4 additions and 1 deletions

View File

@ -396,7 +396,7 @@ int iks_attrib_is_decimal_between_zero_and_one(const char *value)
{ {
if (value && *value && switch_is_number(value)) { if (value && *value && switch_is_number(value)) {
double value_d = atof(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; return SWITCH_TRUE;
} }
} }

View File

@ -912,6 +912,7 @@ void rayo_message_send(struct rayo_actor *from, const char *to, iks *payload, in
{ {
const char *msg_name; const char *msg_name;
struct rayo_message *msg = malloc(sizeof(*msg)); struct rayo_message *msg = malloc(sizeof(*msg));
switch_assert(msg);
if (dup) { if (dup) {
msg->payload = iks_copy(payload); msg->payload = iks_copy(payload);
} else { } else {

View 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) { if (type == IKS_OPEN || type == IKS_SINGLE) {
struct nlsml_node *child_node = malloc(sizeof(*child_node)); struct nlsml_node *child_node = malloc(sizeof(*child_node));
switch_assert(child_node);
child_node->name = name; child_node->name = name;
child_node->tag_def = switch_core_hash_find(globals.tag_defs, name); child_node->tag_def = switch_core_hash_find(globals.tag_defs, name);
if (!child_node->tag_def) { if (!child_node->tag_def) {

View File

@ -310,6 +310,7 @@ iks *rayo_cpa_component_start(struct rayo_actor *call, struct rayo_message *msg,
have_grammar = 1; have_grammar = 1;
url_dup = strdup(url); url_dup = strdup(url);
switch_assert(url_dup);
if ((url_params = strchr(url_dup, '?'))) { if ((url_params = strchr(url_dup, '?'))) {
*url_params = '\0'; *url_params = '\0';
url_params++; url_params++;