transcodebin: fix caps leak
authorGuillaume Desmottes <guillaume.desmottes@collabora.com>
Tue, 25 Feb 2020 15:33:06 +0000 (21:03 +0530)
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Wed, 26 Feb 2020 03:23:20 +0000 (03:23 +0000)
encodecaps was leaked if the profile has restrictions.

gst/transcode/gsttranscodebin.c

index 51812f4..e69897a 100644 (file)
@@ -293,14 +293,16 @@ make_decodebin (GstTranscodeBin * self)
           gst_encoding_container_profile_get_profiles
           (GST_ENCODING_CONTAINER_PROFILE (self->profile)); tmp;
           tmp = tmp->next) {
-        GstCaps *encodecaps = gst_encoding_profile_get_format (tmp->data);
         GstCaps *restrictions =
             gst_encoding_profile_get_restriction (tmp->data);
 
-        if (!restrictions)
+        if (!restrictions) {
+          GstCaps *encodecaps = gst_encoding_profile_get_format (tmp->data);
+
           gst_caps_append (decodecaps, encodecaps);
-        else
+        } else {
           gst_caps_unref (restrictions);
+        }
       }
     }
     g_object_set (self->decodebin, "caps", decodecaps, NULL);