loader: fix potential memory leak

Signed-off-by: Cao jin <caoj.fnst@cn.fujitsu.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
Cao jin 2016-02-24 17:12:47 +08:00 committed by Michael Tokarev
parent ec609656fc
commit ed2f3bc1fa
1 changed files with 6 additions and 0 deletions

View File

@ -914,10 +914,16 @@ int rom_add_file(const char *file, const char *fw_dir,
err: err:
if (fd != -1) if (fd != -1)
close(fd); close(fd);
g_free(rom->data); g_free(rom->data);
g_free(rom->path); g_free(rom->path);
g_free(rom->name); g_free(rom->name);
if (fw_dir) {
g_free(rom->fw_dir);
g_free(rom->fw_file);
}
g_free(rom); g_free(rom);
return -1; return -1;
} }