cli: remove unused variable assigment
[project/uci.git] / cli.c
diff --git a/cli.c b/cli.c
index f8b45dba091f088f84e22dc98503fe9e6e1fd7e3..8970f4f0b8cec1f0eed0804272e22bcfeb06d667 100644 (file)
--- a/cli.c
+++ b/cli.c
@@ -113,8 +113,16 @@ uci_lookup_section_ref(struct uci_section *s)
                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)
@@ -563,7 +571,7 @@ static int uci_batch_cmd(void)
                        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;