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>
diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c
index 31c9344..4d5f805 100644
--- a/arch/sandbox/cpu/os.c
+++ b/arch/sandbox/cpu/os.c
@@ -367,6 +367,7 @@
 
 done:
 	closedir(dir);
+	free(fname);
 	return ret;
 }
 
diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
index 0df7770..42353d8 100644
--- a/arch/sandbox/cpu/start.c
+++ b/arch/sandbox/cpu/start.c
@@ -130,7 +130,8 @@
 	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;
 	}