gloverlaycompositor: Don't leak caps feature
authorEdward Hervey <edward@centricular.com>
Tue, 5 May 2020 15:17:57 +0000 (17:17 +0200)
committerEdward Hervey <bilboed@bilboed.com>
Tue, 5 May 2020 15:17:57 +0000 (17:17 +0200)
Only copy it if we really are going to modify and use it

CID #1439873

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/652>

ext/gl/gstgloverlaycompositorelement.c

index 944ed6a..946cf98 100644 (file)
@@ -156,16 +156,13 @@ _oce_transform_internal_caps (GstGLFilter * filter,
     for (i = 0; i < n; i++) {
       GstCapsFeatures *feat = gst_caps_get_features (removed, i);
 
-      if (feat) {
+      if (feat && gst_caps_features_contains (feat,
+              GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION)) {
         feat = gst_caps_features_copy (feat);
-
-        if (gst_caps_features_contains (feat,
-                GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION)) {
-          /* prefer the passthrough case */
-          gst_caps_features_remove (feat,
-              GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION);
-          gst_caps_set_features (removed, i, feat);
-        }
+        /* prefer the passthrough case */
+        gst_caps_features_remove (feat,
+            GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION);
+        gst_caps_set_features (removed, i, feat);
       }
     }