]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
sandbox: Fix warnings in cpu.c and os.c
authorSimon Glass <sjg@chromium.org>
Tue, 11 Nov 2014 19:47:08 +0000 (12:47 -0700)
committerSimon Glass <sjg@chromium.org>
Thu, 27 Nov 2014 03:25:39 +0000 (20:25 -0700)
This fixes the following two problems:

cppcheck reports:
[arch/sandbox/cpu/start.c:132]: (error) Uninitialized variable: err
[arch/sandbox/cpu/os.c:371]: (error) Memory leak: fname

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Wolfgang Denk <wd@denx.de>
arch/sandbox/cpu/os.c
arch/sandbox/cpu/start.c

index 31c93443dba008036e49723fe284eab58a40bda1..4d5f8057533e89f2ed6edd0298ac4c69038360eb 100644 (file)
@@ -367,6 +367,7 @@ int os_dirent_ls(const char *dirname, struct os_dirent_node **headp)
 
 done:
        closedir(dir);
+       free(fname);
        return ret;
 }
 
index 0df77704c6f769c7085940ca81592d064c7362af..42353d80a847bc51eade86f414e72238a8a4916f 100644 (file)
@@ -130,7 +130,8 @@ static int sandbox_cmdline_cb_memory(struct sandbox_state *state,
        state->write_ram_buf = true;
        state->ram_buf_fname = arg;
 
-       if (os_read_ram_buf(arg)) {
+       err = os_read_ram_buf(arg);
+       if (err) {
                printf("Failed to read RAM buffer\n");
                return err;
        }