rtph264depay : fix mem leak 24/134424/1
authorEunhae Choi <eunhae1.choi@samsung.com>
Fri, 16 Jun 2017 09:45:07 +0000 (18:45 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Fri, 16 Jun 2017 09:45:07 +0000 (18:45 +0900)
Change-Id: Ic6255805254c15b9c01cdadcbecb2111e2a9bf7a

gst/rtp/gstrtph264depay.c

index cd05e62..ea07b65 100644 (file)
@@ -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),