diff options
author | Peter Maydell | 2021-01-18 16:19:06 +0100 |
---|---|---|
committer | Peter Maydell | 2021-01-18 16:19:06 +0100 |
commit | e43d564fa3a0d1e133935c8180ad4f4ccf699f33 (patch) | |
tree | 65874cd221c8b3b0fe6dc0fe3f2289d6a46cda31 /hw/misc | |
parent | Merge remote-tracking branch 'remotes/stsquad/tags/pull-testing-and-misc-1801... (diff) | |
parent | hw/ide/ahci: Replace fprintf() by qemu_log_mask(GUEST_ERROR) (diff) | |
download | qemu-e43d564fa3a0d1e133935c8180ad4f4ccf699f33.tar.gz qemu-e43d564fa3a0d1e133935c8180ad4f4ccf699f33.tar.xz qemu-e43d564fa3a0d1e133935c8180ad4f4ccf699f33.zip |
Merge remote-tracking branch 'remotes/vivier2/tags/trivial-branch-for-6.0-pull-request' into staging
Trivial patches 20210118
Fix memory leaks
Use qemu_log_mask(GUEST_ERROR) rather than error_report().
# gpg: Signature made Mon 18 Jan 2021 11:31:10 GMT
# gpg: using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C
# gpg: issuer "laurent@vivier.eu"
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full]
# gpg: aka "Laurent Vivier <laurent@vivier.eu>" [full]
# gpg: aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full]
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F 5173 F30C 38BD 3F2F BE3C
* remotes/vivier2/tags/trivial-branch-for-6.0-pull-request:
hw/ide/ahci: Replace fprintf() by qemu_log_mask(GUEST_ERROR)
misc/mos6522: Use timer_free() in the finalize function to avoid memleak
pl031: Use timer_free() in the finalize function to avoid memleaks
hw/virtio-pci: Replace error_report() by qemu_log_mask(GUEST_ERROR)
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/misc')
-rw-r--r-- | hw/misc/mos6522.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/hw/misc/mos6522.c b/hw/misc/mos6522.c index ac4cd1d58e..1c57332b40 100644 --- a/hw/misc/mos6522.c +++ b/hw/misc/mos6522.c @@ -490,6 +490,14 @@ static void mos6522_init(Object *obj) s->timers[1].timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, mos6522_timer2, s); } +static void mos6522_finalize(Object *obj) +{ + MOS6522State *s = MOS6522(obj); + + timer_free(s->timers[0].timer); + timer_free(s->timers[1].timer); +} + static Property mos6522_properties[] = { DEFINE_PROP_UINT64("frequency", MOS6522State, frequency, 0), DEFINE_PROP_END_OF_LIST() @@ -519,6 +527,7 @@ static const TypeInfo mos6522_type_info = { .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(MOS6522State), .instance_init = mos6522_init, + .instance_finalize = mos6522_finalize, .abstract = true, .class_size = sizeof(MOS6522DeviceClass), .class_init = mos6522_class_init, |