fix memory leak issue 30/128130/2 accepted/tizen/unified/20170510.012902 submit/tizen/20170508.051609 tizen_4.0.m1_release
authorSeokHoon Lee <andy.shlee@samsung.com>
Mon, 8 May 2017 00:59:33 +0000 (09:59 +0900)
committerSeokHoon Lee <andy.shlee@samsung.com>
Mon, 8 May 2017 04:00:36 +0000 (13:00 +0900)
- add g_free after using url_str in function gst_rtsp_wfd_client_trigger_request
- remove additioanl g_strdup for SET_PARAMETER and GET_PARAMETER
   in function M3, M4, M16_message

Signed-off-by: SeokHoon Lee <andy.shlee@samsung.com>
Change-Id: Iac82ce7d8b987e82842eb55275a27ce8a550e04f

gst/rtsp-server/rtsp-client-wfd.c
packaging/gst-rtsp-server.spec

index f6cb221..93b1fea 100644 (file)
@@ -2492,20 +2492,11 @@ gst_prepare_request (GstRTSPWFDClient * client, GstRTSPMessage * request,
   GstRTSPResult res = GST_RTSP_OK;
   gchar *str = NULL;
 
-  if (method == GST_RTSP_GET_PARAMETER || method == GST_RTSP_SET_PARAMETER) {
-    g_free (url);
-    url = g_strdup ("rtsp://localhost/wfd1.0");
-  }
-
   GST_DEBUG_OBJECT (client, "Preparing request: %d", method);
 
   /* initialize the request */
   res = gst_rtsp_message_init_request (request, method, url);
 
-  if (method == GST_RTSP_GET_PARAMETER || method == GST_RTSP_SET_PARAMETER) {
-    g_free (url);
-  }
-
   if (res < 0) {
     GST_ERROR ("init request failed");
     return res;
@@ -2943,28 +2934,10 @@ handle_M3_message (GstRTSPWFDClient * client)
 {
   GstRTSPResult res = GST_RTSP_OK;
   GstRTSPMessage request = { 0 };
-  GstRTSPUrl *url = NULL;
-  gchar *url_str = NULL;
-
-  GstRTSPClient *parent_client = GST_RTSP_CLIENT_CAST (client);
-  GstRTSPConnection *connection =
-      gst_rtsp_client_get_connection (parent_client);
-
-  url = gst_rtsp_connection_get_url (connection);
-  if (url == NULL) {
-    GST_ERROR_OBJECT (client, "Failed to get connection URL");
-    res = GST_RTSP_ERROR;
-    goto error;
-  }
 
-  url_str = gst_rtsp_url_get_request_uri (url);
-  if (url_str == NULL) {
-    GST_ERROR_OBJECT (client, "Failed to get connection URL");
-    res = GST_RTSP_ERROR;
-    goto error;
-  }
+  res = gst_prepare_request (client, &request, GST_RTSP_GET_PARAMETER,
+                            (gchar *) "rtsp://localhost/wfd1.0");
 
-  res = gst_prepare_request (client, &request, GST_RTSP_GET_PARAMETER, url_str);
   if (GST_RTSP_OK != res) {
     GST_ERROR_OBJECT (client, "Failed to prepare M3 request....\n");
     goto error;
@@ -2973,11 +2946,10 @@ handle_M3_message (GstRTSPWFDClient * client)
   GST_DEBUG_OBJECT (client, "Sending GET_PARAMETER request message (M3)...");
 
   gst_send_request (client, NULL, &request);
-  g_free(url_str);
+
   return res;
 
 error:
-  g_free(url_str);
   return res;
 }
 
@@ -2986,28 +2958,10 @@ handle_M4_message (GstRTSPWFDClient * client)
 {
   GstRTSPResult res = GST_RTSP_OK;
   GstRTSPMessage request = { 0 };
-  GstRTSPUrl *url = NULL;
-  gchar *url_str = NULL;
-
-  GstRTSPClient *parent_client = GST_RTSP_CLIENT_CAST (client);
-  GstRTSPConnection *connection =
-      gst_rtsp_client_get_connection (parent_client);
-
-  url = gst_rtsp_connection_get_url (connection);
-  if (url == NULL) {
-    GST_ERROR_OBJECT (client, "Failed to get connection URL");
-    res = GST_RTSP_ERROR;
-    goto error;
-  }
 
-  url_str = gst_rtsp_url_get_request_uri (url);
-  if (url_str == NULL) {
-    GST_ERROR_OBJECT (client, "Failed to get connection URL");
-    res = GST_RTSP_ERROR;
-    goto error;
-  }
+  res = gst_prepare_request (client, &request, GST_RTSP_SET_PARAMETER,
+                            (gchar *) "rtsp://localhost/wfd1.0");
 
-  res = gst_prepare_request (client, &request, GST_RTSP_SET_PARAMETER, url_str);
   if (GST_RTSP_OK != res) {
     GST_ERROR_OBJECT (client, "Failed to prepare M4 request....\n");
     goto error;
@@ -3051,6 +3005,8 @@ gst_rtsp_wfd_client_trigger_request (GstRTSPWFDClient * client,
   }
 
   res = prepare_trigger_request (client, &request, type, url_str);
+  g_free (url_str);
+
   if (GST_RTSP_OK != res) {
     GST_ERROR_OBJECT (client, "Failed to prepare M5 request....\n");
     goto error;
@@ -3157,20 +3113,16 @@ handle_M16_message (GstRTSPWFDClient * client)
 {
   GstRTSPResult res = GST_RTSP_OK;
   GstRTSPMessage request = { 0 };
-  gchar *url_str = NULL;
 
-  url_str = g_strdup ("rtsp://localhost/wfd1.0");
+  res = gst_rtsp_message_init_request (&request, GST_RTSP_GET_PARAMETER,
+                                    (gchar *) "rtsp://localhost/wfd1.0");
 
-  res =
-      gst_rtsp_message_init_request (&request, GST_RTSP_GET_PARAMETER, url_str);
   if (res < 0) {
     GST_ERROR ("init request failed");
-    g_free (url_str);
     return FALSE;
   }
 
   gst_send_request (client, NULL, &request);
-  g_free (url_str);
   return GST_RTSP_OK;
 }
 
index a783f26..d8ebea3 100644 (file)
@@ -1,7 +1,7 @@
 Name:       gst-rtsp-server
 Summary:    Multimedia Framework Library
 Version:    1.6.1
-Release:    15
+Release:    16
 Url:        http://gstreamer.freedesktop.org/
 Group:      System/Libraries
 License:    LGPL-2.0+