提交 f4c9048e authored 作者: Andrey Volk's avatar Andrey Volk

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

上级 7afec393
...@@ -396,7 +396,7 @@ int iks_attrib_is_decimal_between_zero_and_one(const char *value) ...@@ -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;
} }
} }
......
...@@ -912,6 +912,7 @@ void rayo_message_send(struct rayo_actor *from, const char *to, iks *payload, in ...@@ -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 {
......
...@@ -271,6 +271,7 @@ static int tag_hook(void *user_data, char *name, char **atts, int type) ...@@ -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) {
......
...@@ -310,6 +310,7 @@ iks *rayo_cpa_component_start(struct rayo_actor *call, struct rayo_message *msg, ...@@ -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++;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论