Merge "fix memory leak" into tizen_3.0
authoreunhae choi <eunhae1.choi@samsung.com>
Wed, 4 Jan 2017 10:01:28 +0000 (02:01 -0800)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Wed, 4 Jan 2017 10:01:28 +0000 (02:01 -0800)
ext/sdl/sdlvideosink.c
gst/mxf/mxfdemux.c
gst/sdp/gstsdpdemux.c
gst/tta/gstttadec.c
gst/tta/gstttaparse.c
sys/applemedia/vtenc.c
sys/dshowdecwrapper/gstdshowvideodec.cpp
sys/dvb/dvbbasebin.c

index 7f05dca..72d93e5 100644 (file)
@@ -39,7 +39,7 @@
 GST_DEBUG_CATEGORY_EXTERN (sdl_debug);
 #define GST_CAT_DEFAULT sdl_debug
 
-/* These macros are adapted from videotestsrc.c 
+/* These macros are adapted from videotestsrc.c
  *  and/or gst-plugins/gst/games/gstvideoimage.c */
 #define I420_Y_ROWSTRIDE(width) (GST_ROUND_UP_4(width))
 #define I420_U_ROWSTRIDE(width) (GST_ROUND_UP_8(width)/2)
@@ -157,6 +157,7 @@ gst_sdlvideosink_base_init (gpointer g_class)
       "Ronald Bultje <rbultje@ronald.bitfreak.net>, "
       "Edgard Lima <edgard.lima@indt.org.br>, "
       "Jan Schmidt <thaytan@mad.scientist.com>");
+  gst_caps_unref(capslist);
 }
 
 static void
@@ -344,7 +345,7 @@ gst_sdlvideosink_supported (GstImplementsInterface * interface,
   return result;
 }
 
-/* SDL Video sink and X overlay: 
+/* SDL Video sink and X overlay:
  *
  * SDL supports creating an Xv window/overlay within an existing X window
  * through the horrible mechanism of setting the WINDOWID environment
@@ -356,7 +357,7 @@ gst_sdlvideosink_supported (GstImplementsInterface * interface,
  * that information. The only way to get it would be to do what X[v]imagesink
  * does and retrieve it using X11 calls, and linking to Xlib. That would
  * defeat the whole purpose of using the SDL abstraction and plugin entirely
- * however. 
+ * however.
  *
  * I have no nice solution to this problem for you, dear readers.
  */
index e45e49c..9423ae0 100644 (file)
@@ -3782,6 +3782,8 @@ gst_mxf_demux_src_query (GstPad * pad, GstObject * parent, GstQuery * query)
           gst_query_set_seeking (query, GST_FORMAT_TIME, TRUE, 0, -1);
         else
           gst_query_set_seeking (query, GST_FORMAT_TIME, FALSE, -1, -1);
+
+        gst_query_unref(peerquery);
       }
 
       break;
@@ -4077,6 +4079,8 @@ gst_mxf_demux_query (GstElement * element, GstQuery * query)
           gst_query_set_seeking (query, GST_FORMAT_TIME, TRUE, 0, -1);
         else
           gst_query_set_seeking (query, GST_FORMAT_TIME, FALSE, -1, -1);
+
+        gst_query_unref(peerquery);
       }
 
       break;
index 67e4afd..e99a2bb 100644 (file)
  * For each stream listed in the SDP a new stream_\%u pad will be created
  * with caps derived from the SDP media description. This is a caps of mime type
  * "application/x-rtp" that can be connected to any available RTP depayloader
- * element. 
- * 
+ * element.
+ *
  * sdpdemux will internally instantiate an RTP session manager element
  * that will handle the RTCP messages to and from the server, jitter removal,
- * packet reordering along with providing a clock for the pipeline. 
- * 
- * sdpdemux acts like a live element and will therefore only generate data in the 
+ * packet reordering along with providing a clock for the pipeline.
+ *
+ * sdpdemux acts like a live element and will therefore only generate data in the
  * PLAYING state.
- * 
+ *
  * <refsect2>
  * <title>Example launch line</title>
  * |[
@@ -564,7 +564,7 @@ gst_sdp_demux_parse_rtpmap (const gchar * rtpmap, gint * payload, gchar ** name,
 /*
  *  Mapping of caps to and from SDP fields:
  *
- *   m=<media> <UDP port> RTP/AVP <payload> 
+ *   m=<media> <UDP port> RTP/AVP <payload>
  *   a=rtpmap:<payload> <encoding_name>/<clock_rate>[/<encoding_params>]
  *   a=fmtp:<payload> <param>[=<value>];...
  */
@@ -1125,7 +1125,7 @@ gst_sdp_demux_stream_configure_udp_sink (GstSDPDemux * demux,
     /* not very fatal, we just won't be able to send RTCP */
     GST_WARNING_OBJECT (demux, "could not get session RTCP pad");
   }
-
+  gst_object_unref(pad);
 
   return TRUE;
 
index f4e29a2..eba65ce 100644 (file)
@@ -3,7 +3,7 @@
  *
  * based on ttalib
  * (c) 1999-2004 Alexander Djourik <sasha@iszf.irk.ru>
- * 
+ *
  * gstttadec.c: raw TTA bitstream decoder
  *
  * This library is free software; you can redistribute it and/or
@@ -127,8 +127,11 @@ gst_tta_dec_setcaps (GstPad * pad, GstCaps * caps)
       "endianness", G_TYPE_INT, G_BYTE_ORDER,
       "signed", G_TYPE_BOOLEAN, TRUE, NULL);
 
-  if (!gst_pad_set_caps (ttadec->srcpad, srccaps))
+  if (!gst_pad_set_caps (ttadec->srcpad, srccaps)) {
+    gst_caps_unref(srccaps);
     return FALSE;
+  }
+  gst_caps_unref(srccaps);
 
   ttadec->frame_length = FRAME_TIME * ttadec->samplerate;
 
index 9d3b8b4..30590c4 100644 (file)
@@ -380,6 +380,7 @@ gst_tta_parse_parse_header (GstTtaParse * ttaparse)
       "channels", G_TYPE_INT, ttaparse->channels,
       "rate", G_TYPE_INT, ttaparse->samplerate, NULL);
   gst_pad_set_caps (ttaparse->srcpad, caps);
+  gst_caps_unref(caps);
 
   discont =
       gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_TIME, 0,
index b688004..258e4e4 100644 (file)
@@ -180,6 +180,7 @@ gst_vtenc_base_init (GstVTEncClass * klass)
   src_template = gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
       src_caps);
   gst_element_class_add_pad_template (element_class, src_template);
+  gst_caps_unref(src_caps);
 }
 
 static void
index eac0f72..8e783f6 100644 (file)
@@ -114,8 +114,8 @@ static PreferredFilter preferred_wmv_filters[] = {
   {&CLSID_CWMVDecMediaObject, &DMOCATEGORY_VIDEO_DECODER}, {0}
 };
 
-static const GUID CLSID_AVI_DECOMPRESSOR = 
-  {0xCF49D4E0, 0x1115, 0x11CE, 
+static const GUID CLSID_AVI_DECOMPRESSOR =
+  {0xCF49D4E0, 0x1115, 0x11CE,
    {0xB0, 0x3A, 0x00, 0x20, 0xAF, 0x0B, 0xA7, 0x70}};
 static PreferredFilter preferred_cinepack_filters[] = {
   {&CLSID_AVI_DECOMPRESSOR}, {0}
@@ -132,8 +132,8 @@ static PreferredFilter preferred_mp4s_filters[] = {
 static PreferredFilter preferred_mp43_filters[] = {
   {&CLSID_CMpeg43DecMediaObject, &DMOCATEGORY_VIDEO_DECODER}, {0}};
 
-static const GUID CLSID_MPEG_VIDEO_DECODER = 
-  {0xFEB50740, 0x7BEF, 0x11CE, 
+static const GUID CLSID_MPEG_VIDEO_DECODER =
+  {0xFEB50740, 0x7BEF, 0x11CE,
    {0x9B, 0xD9, 0x00, 0x00, 0xE2, 0x02, 0x59, 0x9C}};
 static PreferredFilter preferred_mpeg1_filters[] = {
   {&CLSID_MPEG_VIDEO_DECODER}, {0}
@@ -240,7 +240,7 @@ static const VideoCodecEntry video_dec_codecs[] = {
    GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_YUY2,
    GST_VIDEO_CAPS_MAKE("YUY2"),
    preferred_mpeg1_filters},
-   
+
   {"dshowvdec_mpeg4", "MPEG-4 Video",
    GST_MAKE_FOURCC ('M', 'P', 'G', '4'),
    GUID_MEDIATYPE_VIDEO, GUID_MEDIASUBTYPE_MPG4,
@@ -328,7 +328,7 @@ HRESULT VideoFakeSink::DoRenderSample(IMediaSample *pMediaSample)
 
     gst_buffer_map(buf, &map, GST_MAP_WRITE);
     if (strstr (klass->entry->srccaps, "rgb")) {
-      /* FOR RGB directshow decoder will return bottom-up BITMAP 
+      /* FOR RGB directshow decoder will return bottom-up BITMAP
        * There is probably a way to get top-bottom video frames from
        * the decoder...
        */
@@ -390,7 +390,7 @@ gst_dshowvideodec_base_init (gpointer klass)
   description = g_strdup_printf ("DirectShow %s Decoder Wrapper",
       tmp->element_longname);
 
-  gst_element_class_set_metadata(element_class, longname, "Codec/Decoder/Video", description, 
+  gst_element_class_set_metadata(element_class, longname, "Codec/Decoder/Video", description,
     "Sebastien Moutte <sebastien@moutte.net>");
 
   g_free (longname);
@@ -409,6 +409,9 @@ gst_dshowvideodec_base_init (gpointer klass)
 
   gst_element_class_add_pad_template (element_class, src);
   gst_element_class_add_pad_template (element_class, sink);
+
+  gst_caps_unref(sinkcaps);
+  gst_caps_unref(srccaps);
 }
 
 static void
@@ -782,7 +785,7 @@ gst_dshowvideodec_sink_setcaps (GstPad * pad, GstCaps * caps)
           "framerate", GST_TYPE_FRACTION, vdec->fps_n, vdec->fps_d, NULL);
   }
 
-  gst_caps_set_simple (caps_out, 
+  gst_caps_set_simple (caps_out,
       "pixel-aspect-ratio", GST_TYPE_FRACTION, vdec->par_n, vdec->par_d, NULL);
 
   if (!gst_pad_set_caps (vdec->srcpad, caps_out)) {
@@ -986,7 +989,7 @@ gst_dshowvideodec_src_getcaps (GstPad * pad)
       enum_mediatypes->Reset();
       while (hres =
           enum_mediatypes->Next(1, &mediatype, &fetched),
-          hres == S_OK) 
+          hres == S_OK)
       {
         VIDEOINFOHEADER *video_info;
         GstCaps *mediacaps = NULL;
@@ -1080,7 +1083,7 @@ gst_dshowvideodec_get_filter_output_format (GstDshowVideoDec * vdec,
     enum_mediatypes->Reset();
     while (hres =
         enum_mediatypes->Next(1, &mediatype, &fetched),
-        hres == S_OK) 
+        hres == S_OK)
     {
       if (IsEqualGUID (mediatype->subtype, subtype) &&
           IsEqualGUID (mediatype->formattype, FORMAT_VideoInfo))
index e89febd..58cfa87 100644 (file)
@@ -752,6 +752,7 @@ dvb_base_bin_request_new_pad (GstElement * element,
   ghost = gst_ghost_pad_new (pad_name, pad);
   g_free (pad_name);
   gst_element_add_pad (element, ghost);
+  gst_object_unref(pad);
 
   return ghost;
 }