ccconverter: don't debug a potentially freed filter caps
authorMatthew Waters <matthew@centricular.com>
Tue, 21 Feb 2023 04:19:35 +0000 (15:19 +1100)
committerTim-Philipp Müller <tim@centricular.com>
Tue, 21 Feb 2023 10:09:46 +0000 (10:09 +0000)
Fixes a use-after-free

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

subprojects/gst-plugins-bad/ext/closedcaption/gstccconverter.c

index 14ac7c6..8623913 100644 (file)
@@ -352,7 +352,6 @@ gst_cc_converter_transform_caps (GstBaseTransform * base,
 
     tmp = gst_caps_intersect_full (filter, res, GST_CAPS_INTERSECT_FIRST);
     gst_caps_unref (res);
-    gst_caps_unref (filter);
     res = tmp;
   }
 
@@ -363,6 +362,8 @@ gst_cc_converter_transform_caps (GstBaseTransform * base,
   GST_DEBUG_OBJECT (self, "filter %" GST_PTR_FORMAT, filter);
   GST_DEBUG_OBJECT (self, "to %" GST_PTR_FORMAT, res);
 
+  gst_clear_caps (&filter);
+
   return res;
 }