OSDN Git Service

hw/input/stellaris_gamepad: Free StellarisGamepad::keycodes[] array
authorPhilippe Mathieu-Daudé <philmd@linaro.org>
Tue, 21 Nov 2023 17:40:51 +0000 (18:40 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Mon, 27 Nov 2023 15:27:46 +0000 (15:27 +0000)
commit6e782ffd555808378f69dd606641f0c4b5ca6120
tree316fcdc2da7449b54a5a7de0da746632d1829215
parent4f10c66077e39969940d928077560665e155cac8
hw/input/stellaris_gamepad: Free StellarisGamepad::keycodes[] array

Commit 0be6bfac62 ("qdev: Implement variable length array properties")
added the DEFINE_PROP_ARRAY() macro with the following comment:

  * It is the responsibility of the device deinit code to free the
  * @_arrayfield memory.

Commit a75f336b97 added:

  DEFINE_PROP_ARRAY("keycodes", StellarisGamepad, num_buttons,
                    keycodes, qdev_prop_uint32, uint32_t),

but forgot to free the 'keycodes' array. Do it in the instance_finalize
handler.

Fixes: a75f336b97 ("hw/input/stellaris_input: Convert to qdev")
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-id: 20231121174051.63038-7-philmd@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/input/stellaris_gamepad.c