From ed2f3bc1fad37297468234add82f464b59b16830 Mon Sep 17 00:00:00 2001 From: Cao jin Date: Wed, 24 Feb 2016 17:12:47 +0800 Subject: [PATCH] loader: fix potential memory leak Signed-off-by: Cao jin Signed-off-by: Michael Tokarev --- hw/core/loader.c | 6 ++++++ 1 file changed, 6 insertions(+) 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; }