summaryrefslogtreecommitdiffstats
path: root/hw/core/loader.c
diff options
context:
space:
mode:
authorCao jin2016-02-24 10:12:47 +0100
committerMichael Tokarev2016-05-18 14:04:26 +0200
commited2f3bc1fad37297468234add82f464b59b16830 (patch)
tree043d3d87b034bfa44b29c796d04febf0ec1967e5 /hw/core/loader.c
parentremove comment for nonexistent structure member (diff)
downloadqemu-ed2f3bc1fad37297468234add82f464b59b16830.tar.gz
qemu-ed2f3bc1fad37297468234add82f464b59b16830.tar.xz
qemu-ed2f3bc1fad37297468234add82f464b59b16830.zip
loader: fix potential memory leak
Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'hw/core/loader.c')
-rw-r--r--hw/core/loader.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/core/loader.c b/hw/core/loader.c
index c0499571c3..53e0e41554 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -914,10 +914,16 @@ int rom_add_file(const char *file, const char *fw_dir,
err:
if (fd != -1)
close(fd);
+
g_free(rom->data);
g_free(rom->path);
g_free(rom->name);
+ if (fw_dir) {
+ g_free(rom->fw_dir);
+ g_free(rom->fw_file);
+ }
g_free(rom);
+
return -1;
}