aboutsummaryrefslogtreecommitdiff
path: root/hw/core
diff options
context:
space:
mode:
authorCao jin <caoj.fnst@cn.fujitsu.com>2016-02-24 17:12:47 +0800
committerMichael Tokarev <mjt@tls.msk.ru>2016-05-18 15:04:26 +0300
commited2f3bc1fad37297468234add82f464b59b16830 (patch)
tree043d3d87b034bfa44b29c796d04febf0ec1967e5 /hw/core
parentec609656fc12573c35e2bca58d9b1451fb7e4cf2 (diff)
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')
-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;
}