summaryrefslogtreecommitdiffstats
path: root/libnetdata
diff options
context:
space:
mode:
authorthiagoftsm <thiagoftsm@gmail.com>2019-10-02 10:59:48 +0000
committerGitHub <noreply@github.com>2019-10-02 10:59:48 +0000
commitf197e2d9901be1b462edd53b227e01f5d7a9483a (patch)
treeea1d3cd229de5d84a7696a9275af7b1fd2c6cf06 /libnetdata
parent1d667b145c16811639143afa377293d3ef8d62f0 (diff)
Coverity 20190924 (#6941)
* coverity_20190924: Fix 215633 In the switch the library stops case this pointer is NULL, so there is not necessity to processed with tests * coverity_20190924: Fix 338067 The current code tries to copy the same size of the variable, another possible solution would be to use a function to sanitize the code, I will try this first * coverity_20190924: Fix 348638 Considering that we are testing the variable value one line above The division will always happen * coverity_20190924: Fix 348640 For this specific case we do not have the possibility to have memory leak, valgrind confirms this, but I am adding a new variable here to the stack to discard the warning
Diffstat (limited to 'libnetdata')
-rw-r--r--libnetdata/health/health.c3
-rw-r--r--libnetdata/json/jsmn.c10
2 files changed, 8 insertions, 5 deletions
diff --git a/libnetdata/health/health.c b/libnetdata/health/health.c
index b93de8b93e..a70f284b1f 100644
--- a/libnetdata/health/health.c
+++ b/libnetdata/health/health.c
@@ -136,7 +136,8 @@ int health_silencers_json_read_callback(JSON_ENTRY *e)
else if (!strcmp(e->data.string,"DISABLE")) silencers->stype = STYPE_DISABLE_ALARMS;
} else {
debug(D_HEALTH, "JSON: Adding %s=%s", e->name, e->data.string);
- health_silencers_addparam(e->callback_data, e->name, e->data.string);
+ SILENCER *test = health_silencers_addparam(e->callback_data, e->name, e->data.string);
+ (void)test;
}
break;
diff --git a/libnetdata/json/jsmn.c b/libnetdata/json/jsmn.c
index c8d9e73db9..9525358975 100644
--- a/libnetdata/json/jsmn.c
+++ b/libnetdata/json/jsmn.c
@@ -301,10 +301,12 @@ jsmnerr_t jsmn_parse(jsmn_parser *parser, const char *js, size_t len,
}
}
- for (i = parser->toknext - 1; i >= 0; i--) {
- /* Unmatched opened object or array */
- if (tokens[i].start != -1 && tokens[i].end == -1) {
- return JSMN_ERROR_PART;
+ if (tokens) {
+ for (i = parser->toknext - 1; i >= 0; i--) {
+ /* Unmatched opened object or array */
+ if (tokens[i].start != -1 && tokens[i].end == -1) {
+ return JSMN_ERROR_PART;
+ }
}
}