[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] hw/display/xlnx_dp: Free FIFOs adding xlnx_dp_finalize()
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH] hw/display/xlnx_dp: Free FIFOs adding xlnx_dp_finalize() |
Date: |
Tue, 23 Mar 2021 19:29:58 +0100 |
When building with --enable-sanitizers we get:
Direct leak of 16 byte(s) in 1 object(s) allocated from:
#0 0x5618479ec7cf in malloc (qemu-system-aarch64+0x233b7cf)
#1 0x7f675745f958 in g_malloc (/lib64/libglib-2.0.so.0+0x58958)
#2 0x561847c2dcc9 in xlnx_dp_init hw/display/xlnx_dp.c:1259:5
#3 0x56184a5bdab8 in object_init_with_type qom/object.c:375:9
#4 0x56184a5a2bda in object_initialize_with_type qom/object.c:517:5
#5 0x56184a5a24d5 in object_initialize qom/object.c:536:5
#6 0x56184a5a2f6c in object_initialize_child_with_propsv
qom/object.c:566:5
#7 0x56184a5a2e60 in object_initialize_child_with_props
qom/object.c:549:10
#8 0x56184a5a3a1e in object_initialize_child_internal qom/object.c:603:5
#9 0x5618495aa431 in xlnx_zynqmp_init hw/arm/xlnx-zynqmp.c:273:5
The RX/TX FIFOs are created in xlnx_dp_init(), add xlnx_dp_finalize()
to destroy them.
Fixes: 58ac482a66d ("introduce xlnx-dp")
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/display/xlnx_dp.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/hw/display/xlnx_dp.c b/hw/display/xlnx_dp.c
index c56e6ec5936..4fd6aeb18b5 100644
--- a/hw/display/xlnx_dp.c
+++ b/hw/display/xlnx_dp.c
@@ -1260,6 +1260,14 @@ static void xlnx_dp_init(Object *obj)
fifo8_create(&s->tx_fifo, 16);
}
+static void xlnx_dp_finalize(Object *obj)
+{
+ XlnxDPState *s = XLNX_DP(obj);
+
+ fifo8_destroy(&s->tx_fifo);
+ fifo8_destroy(&s->rx_fifo);
+}
+
static void xlnx_dp_realize(DeviceState *dev, Error **errp)
{
XlnxDPState *s = XLNX_DP(dev);
@@ -1359,6 +1367,7 @@ static const TypeInfo xlnx_dp_info = {
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(XlnxDPState),
.instance_init = xlnx_dp_init,
+ .instance_finalize = xlnx_dp_finalize,
.class_init = xlnx_dp_class_init,
};
--
2.26.2
- [PATCH] hw/display/xlnx_dp: Free FIFOs adding xlnx_dp_finalize(),
Philippe Mathieu-Daudé <=