maxlen = strlen(s->type) + 1 + 2 + 10;
if (!typestr) {
typestr = malloc(maxlen);
+ if (!typestr)
+ return NULL;
} else {
- typestr = realloc(typestr, maxlen);
+ void *p = realloc(typestr, maxlen);
+ if (!p) {
+ free(typestr);
+ return NULL;
+ }
+
+ typestr = p;
}
if (typestr)
uci_perror(ctx, appname);
}
+__attribute__((format(printf, 1, 2)))
static void cli_error(const char *fmt, ...)
{
va_list ap;
return 1;
}
argv[i] = NULL;
- if ((ret = uci_parse_argument(ctx, input, &str, &argv[i])) != UCI_OK) {
+ if (uci_parse_argument(ctx, input, &str, &argv[i]) != UCI_OK) {
cli_perror();
i = 0;
break;