deinterlace: Don't leak metas
authorEdward Hervey <edward@centricular.com>
Thu, 3 Nov 2022 13:06:58 +0000 (14:06 +0100)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Fri, 4 Nov 2022 17:59:21 +0000 (17:59 +0000)
There is no correlation between the frame being NULL and the metas not being
present.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3319>

subprojects/gst-plugins-good/gst/deinterlace/gstdeinterlace.c

index 5cf3eb6..6c209c0 100644 (file)
@@ -781,16 +781,17 @@ gst_deinterlace_pop_history (GstDeinterlace * self)
 static void
 gst_deinterlace_delete_meta_at (GstDeinterlace * self, gint idx)
 {
-  if (self->field_history[idx].frame) {
-    if (self->field_history[idx].tc) {
-      gst_video_time_code_free (self->field_history[idx].tc);
-      self->field_history[idx].tc = NULL;
-    }
-    if (self->field_history[idx].caption) {
-      g_free (self->field_history[idx].caption->data);
-      g_free (self->field_history[idx].caption);
-      self->field_history[idx].caption = NULL;
-    }
+  GST_DEBUG_OBJECT (self, "idx:%d frame %p", idx,
+      self->field_history[idx].frame);
+
+  if (self->field_history[idx].tc) {
+    gst_video_time_code_free (self->field_history[idx].tc);
+    self->field_history[idx].tc = NULL;
+  }
+  if (self->field_history[idx].caption) {
+    g_free (self->field_history[idx].caption->data);
+    g_free (self->field_history[idx].caption);
+    self->field_history[idx].caption = NULL;
   }
 }