aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>2020-10-28 16:08:10 +0100
committerPhilippe Mathieu-Daudé <f4bug@amsat.org>2020-11-09 00:53:07 +0100
commit60f6de8fbafa5dc57af63792e3ba1a910239d195 (patch)
treefb26fc9e6115586760dddacd6ab95384a242b626 /hw
parentf166061c73f070ce98a9003bdaeedd39ab034eed (diff)
downloadqemu-60f6de8fbafa5dc57af63792e3ba1a910239d195.zip
qemu-60f6de8fbafa5dc57af63792e3ba1a910239d195.tar.gz
qemu-60f6de8fbafa5dc57af63792e3ba1a910239d195.tar.bz2
hw/rx/rx-gdbsim: Fix memory leak (CID 1432307)
As load_device_tree() returns allocated memory, we need to free it. Cc: Yoshinori Sato <ysato@users.sourceforge.jp> Fixes: bda19d7bb56 ("hw/rx: Add RX GDB simulator") Reported-by: Coverity (CID 1432307: RESOURCE_LEAK) Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20201102104542.2064745-1-f4bug@amsat.org>
Diffstat (limited to 'hw')
-rw-r--r--hw/rx/rx-gdbsim.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/hw/rx/rx-gdbsim.c b/hw/rx/rx-gdbsim.c
index 417ec05..285549c 100644
--- a/hw/rx/rx-gdbsim.c
+++ b/hw/rx/rx-gdbsim.c
@@ -122,9 +122,8 @@ static void rx_gdbsim_init(MachineState *machine)
if (dtb_filename) {
ram_addr_t dtb_offset;
int dtb_size;
- void *dtb;
+ g_autofree void *dtb = load_device_tree(dtb_filename, &dtb_size);
- dtb = load_device_tree(dtb_filename, &dtb_size);
if (dtb == NULL) {
error_report("Couldn't open dtb file %s", dtb_filename);
exit(1);