These issues was discovered by static analysis tool.
Change-Id: Iea75151c9b1f5e4cb139d2dc4e8a5c8bae5bb303
Signed-off-by: Jose Bollo <jose.bollo@iot.bzh>
}
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;
}
/* 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;
rc = timer_create(CLOCK_THREAD_CPUTIME_ID, &sevp, &thread_timerid);
thread_timer_set = !rc;
}
- return 0;
+ return rc;
}
/*