mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-27 15:12:36 +02:00
dummyflasher.c: Don't leak emu_persistent_image
Ensure `emu_persistent_image` doesn't end up leaking memory. Change-Id: I76529973cefcc6a1472681e1f4da8239fcbf07a6 Signed-off-by: Angel Pons <th3fanbus@gmail.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/54905 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
This commit is contained in:
parent
51c1f39e91
commit
6b1f3b0841
@ -634,9 +634,8 @@ static int dummy_shutdown(void *data)
|
||||
write_buf_to_file(emu_data->flashchip_contents,
|
||||
emu_data->emu_chip_size,
|
||||
emu_data->emu_persistent_image);
|
||||
free(emu_data->emu_persistent_image);
|
||||
emu_data->emu_persistent_image = NULL;
|
||||
}
|
||||
free(emu_data->emu_persistent_image);
|
||||
free(emu_data->flashchip_contents);
|
||||
}
|
||||
#endif
|
||||
@ -1001,6 +1000,7 @@ int dummy_init(void)
|
||||
if (read_buf_from_file(data->flashchip_contents, data->emu_chip_size,
|
||||
data->emu_persistent_image)) {
|
||||
msg_perr("Unable to read %s\n", data->emu_persistent_image);
|
||||
free(data->emu_persistent_image);
|
||||
free(data->flashchip_contents);
|
||||
return 1;
|
||||
}
|
||||
@ -1012,6 +1012,7 @@ int dummy_init(void)
|
||||
|
||||
dummy_init_out:
|
||||
if (register_shutdown(dummy_shutdown, data)) {
|
||||
free(data->emu_persistent_image);
|
||||
free(data->flashchip_contents);
|
||||
free(data);
|
||||
return 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user