From 77455b50d349fdbabba21d6bb494e333dbe85a08 Mon Sep 17 00:00:00 2001 From: He Junyan Date: Fri, 3 May 2024 22:57:57 +0800 Subject: [PATCH] vah265enc: Fix a memory leak when destroying the object Part-of: --- subprojects/gst-plugins-bad/sys/va/gstvah265enc.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/subprojects/gst-plugins-bad/sys/va/gstvah265enc.c b/subprojects/gst-plugins-bad/sys/va/gstvah265enc.c index e5f510eb6b..611354de64 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvah265enc.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvah265enc.c @@ -4941,6 +4941,19 @@ gst_va_h265_enc_get_property (GObject * object, guint prop_id, GST_OBJECT_UNLOCK (self); } +static void +gst_va_h265_enc_dispose (GObject * object) +{ + GstVaH265Enc *self = GST_VA_H265_ENC (object); + + g_clear_pointer (&self->partition.slice_segment_address, g_free); + g_clear_pointer (&self->partition.num_ctu_in_slice, g_free); + g_clear_pointer (&self->partition.tile_ctu_cols, g_free); + g_clear_pointer (&self->partition.tile_ctu_rows, g_free); + + G_OBJECT_CLASS (parent_class)->dispose (object); +} + static void gst_va_h265_enc_class_init (gpointer g_klass, gpointer class_data) { @@ -5001,6 +5014,7 @@ gst_va_h265_enc_class_init (gpointer g_klass, gpointer class_data) object_class->set_property = gst_va_h265_enc_set_property; object_class->get_property = gst_va_h265_enc_get_property; + object_class->dispose = gst_va_h265_enc_dispose; venc_class->flush = GST_DEBUG_FUNCPTR (gst_va_h265_enc_flush); venc_class->start = GST_DEBUG_FUNCPTR (gst_va_h265_enc_start);