hw/arm/collie: Put StrongARMState* into a CollieMachineState struct
commit8a2b76ffc9ff610c3439617e19f1eb9be02be50f
authorPeter Maydell <peter.maydell@linaro.org>
Thu, 26 Mar 2020 20:49:19 +0000 (26 20:49 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Fri, 3 Apr 2020 18:23:37 +0000 (3 19:23 +0100)
tree5b72d5b29fb68af5f96d54e69e89675af1f2e252
parent9231951aa5ac0ae813818b8ff33d4ccaaabb16e8
hw/arm/collie: Put StrongARMState* into a CollieMachineState struct

Coverity complains that the collie_init() function leaks the memory
allocated in sa1110_init().  This is true but not significant since
the function is called only once on machine init and the memory must
remain in existence until QEMU exits anyway.

Still, we can avoid the technical memory leak by keeping the pointer
to the StrongARMState inside the machine state struct.  Switch from
the simple DEFINE_MACHINE() style to defining a subclass of
TYPE_MACHINE which extends the MachineState struct, and keep the
pointer there.

Fixes: CID 1421921
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20200326204919.22006-1-peter.maydell@linaro.org
hw/arm/collie.c