diff options
author | Jose Bollo <jose.bollo@iot.bzh> | 2019-04-12 09:39:34 +0200 |
---|---|---|
committer | Jose Bollo <jose.bollo@iot.bzh> | 2019-04-12 10:55:54 +0200 |
commit | 036629f2e6306f3e2bb520bc58565d9a9db28a45 (patch) | |
tree | df64de93ff5d9bfa3f8b2ad9c36ec771927edb05 | |
parent | 8f12ffa88124632c31d6b6e4c28a2e64aa4ba029 (diff) |
Fix small issues
These issues was discovered by static analysis tool.
Change-Id: Iea75151c9b1f5e4cb139d2dc4e8a5c8bae5bb303
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
-rw-r--r-- | bindings/samples/hello3.c | 1 | ||||
-rw-r--r-- | src/afb-wsj1.c | 6 | ||||
-rw-r--r-- | src/sig-monitor.c | 2 |
3 files changed, 6 insertions, 3 deletions
diff --git a/bindings/samples/hello3.c b/bindings/samples/hello3.c index af194785..ff7da61a 100644 --- a/bindings/samples/hello3.c +++ b/bindings/samples/hello3.c @@ -913,6 +913,7 @@ static void api (afb_req_t request) } sapi->api = afb_api_new_api(api, apiname, NULL, 1, apipreinit, NULL); if (!sapi->api) { + free(sapi); afb_req_reply_f(request, NULL, "cant-create", "%m"); goto end; } diff --git a/src/afb-wsj1.c b/src/afb-wsj1.c index 33e0d195..4080edf2 100644 --- a/src/afb-wsj1.c +++ b/src/afb-wsj1.c @@ -307,11 +307,13 @@ static struct afb_wsj1_msg *wsj1_msg_make(struct afb_wsj1 *wsj1, char *text, siz /* scan */ n = wsj1_msg_scan(text, items); - if (n < 0) + if (n <= 0) goto bad_header; /* scans code: 2|3|4|5 */ - if (items[0][1] != 1) goto bad_header; + if (items[0][1] != 1) + goto bad_header; + switch (text[items[0][0]]) { case '2': msg->code = CALL; break; case '3': msg->code = RETOK; break; diff --git a/src/sig-monitor.c b/src/sig-monitor.c index f15f214e..70592812 100644 --- a/src/sig-monitor.c +++ b/src/sig-monitor.c @@ -154,7 +154,7 @@ static inline int timeout_create() rc = timer_create(CLOCK_THREAD_CPUTIME_ID, &sevp, &thread_timerid); thread_timer_set = !rc; } - return 0; + return rc; } /* |