mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-23 18:12:00 -06:00
hw/arm/virt: Fix memory leak reported by Coverity
As the conditional statement had to be split anyway, we can also add a better error report message. Signed-off-by: Stefan Weil <sw@weilnetz.de> Message-id: 1426877982-3603-1-git-send-email-sw@weilnetz.de Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
db25a15817
commit
4de9a883be
1 changed files with 8 additions and 1 deletions
|
@ -553,6 +553,7 @@ static void create_flash(const VirtBoardInfo *vbi)
|
||||||
|
|
||||||
if (bios_name) {
|
if (bios_name) {
|
||||||
char *fn;
|
char *fn;
|
||||||
|
int image_size;
|
||||||
|
|
||||||
if (drive_get(IF_PFLASH, 0, 0)) {
|
if (drive_get(IF_PFLASH, 0, 0)) {
|
||||||
error_report("The contents of the first flash device may be "
|
error_report("The contents of the first flash device may be "
|
||||||
|
@ -561,7 +562,13 @@ static void create_flash(const VirtBoardInfo *vbi)
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
fn = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
|
fn = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
|
||||||
if (!fn || load_image_targphys(fn, flashbase, flashsize) < 0) {
|
if (!fn) {
|
||||||
|
error_report("Could not find ROM image '%s'", bios_name);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
image_size = load_image_targphys(fn, flashbase, flashsize);
|
||||||
|
g_free(fn);
|
||||||
|
if (image_size < 0) {
|
||||||
error_report("Could not load ROM image '%s'", bios_name);
|
error_report("Could not load ROM image '%s'", bios_name);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue