Commit f80a8bbee8665defb32f26029325667704bb4776

Authored by Simon Glass
1 parent e48f3741c3

sandbox: Fix warnings in cpu.c and os.c

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>

Showing 2 changed files with 3 additions and 1 deletions Side-by-side Diff

arch/sandbox/cpu/os.c
... ... @@ -367,6 +367,7 @@
367 367  
368 368 done:
369 369 closedir(dir);
  370 + free(fname);
370 371 return ret;
371 372 }
372 373  
arch/sandbox/cpu/start.c
... ... @@ -130,7 +130,8 @@
130 130 state->write_ram_buf = true;
131 131 state->ram_buf_fname = arg;
132 132  
133   - if (os_read_ram_buf(arg)) {
  133 + err = os_read_ram_buf(arg);
  134 + if (err) {
134 135 printf("Failed to read RAM buffer\n");
135 136 return err;
136 137 }