From be9d9371b7382284e8afb6adaa808050c8af70e6 Mon Sep 17 00:00:00 2001 From: Hou Qi Date: Fri, 22 Sep 2023 16:57:28 +0900 Subject: [PATCH] v4l2videodec: Correctly free caps to avoid memory leak Part-of: --- subprojects/gst-plugins-good/sys/v4l2/gstv4l2videodec.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videodec.c b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videodec.c index 3019a09a13..c7f39ddee2 100644 --- a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videodec.c +++ b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videodec.c @@ -465,10 +465,8 @@ gst_v4l2_video_dec_negotiate (GstVideoDecoder * decoder) /* Prefer the acquired caps over anything suggested downstream, this ensure * that we preserves the bit depth, as we don't have any fancy fixation * process */ - if (gst_caps_is_subset (acquired_caps, caps)) { - gst_caps_unref (acquired_caps); + if (gst_caps_is_subset (acquired_caps, caps)) goto use_acquired_caps; - } /* Fixate pixel format */ caps = gst_caps_fixate (caps); @@ -482,6 +480,7 @@ gst_v4l2_video_dec_negotiate (GstVideoDecoder * decoder) gst_v4l2_clear_error (&error); use_acquired_caps: + gst_caps_unref (acquired_caps); gst_caps_unref (caps); /* catch possible bogus driver that don't enumerate the format it actually