From 27f8f9050035dcba54848756b20ab9435b4e9704 Mon Sep 17 00:00:00 2001 From: Eunhae Choi Date: Fri, 16 Jun 2017 18:45:07 +0900 Subject: [PATCH] rtph264depay : fix mem leak Change-Id: Ic6255805254c15b9c01cdadcbecb2111e2a9bf7a --- gst/rtp/gstrtph264depay.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/gst/rtp/gstrtph264depay.c b/gst/rtp/gstrtph264depay.c index cd05e62..ea07b65 100644 --- a/gst/rtp/gstrtph264depay.c +++ b/gst/rtp/gstrtph264depay.c @@ -292,6 +292,7 @@ gst_rtp_h264_set_src_caps (GstRtpH264Depay * rtph264depay) { gboolean res; GstCaps *srccaps; + GstCaps *old_caps; if (!rtph264depay->byte_stream && (!rtph264depay->new_codec_data || @@ -422,10 +423,10 @@ gst_rtp_h264_set_src_caps (GstRtpH264Depay * rtph264depay) } - if (gst_pad_has_current_caps (GST_RTP_BASE_DEPAYLOAD_SRCPAD (rtph264depay))) { - GstCaps *old_caps = - gst_pad_get_current_caps (GST_RTP_BASE_DEPAYLOAD_SRCPAD (rtph264depay)); + old_caps = + gst_pad_get_current_caps (GST_RTP_BASE_DEPAYLOAD_SRCPAD (rtph264depay)); + if (old_caps != NULL) { /* Only update the caps if they are not equal. For * AVC we don't update caps if only the codec_data * changes. This is the same behaviour as in h264parse @@ -456,6 +457,7 @@ gst_rtp_h264_set_src_caps (GstRtpH264Depay * rtph264depay) gst_caps_unref (tmp_caps); } + gst_caps_unref (old_caps); } else { res = gst_pad_set_caps (GST_RTP_BASE_DEPAYLOAD_SRCPAD (rtph264depay), -- 2.7.4