sdp: copy and free the server ip address
authorRobert Krakora <rob.krakora at messagenetsystems.com>
Tue, 16 Aug 2011 11:31:52 +0000 (13:31 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Tue, 16 Aug 2011 11:31:52 +0000 (13:31 +0200)
Copy and free the server ip address to make memory management easier later.

gst/rtsp-server/rtsp-client.c
gst/rtsp-server/rtsp-sdp.h

index 070a469..4698726 100644 (file)
@@ -1096,19 +1096,22 @@ create_sdp (GstRTSPClient * client, GstRTSPMedia * media)
 
   info.server_proto = proto;
   if (media->protocols & GST_RTSP_LOWER_TRANS_UDP_MCAST)
-    info.server_ip = MCAST_ADDRESS;
+    info.server_ip = g_strdup (MCAST_ADDRESS);
   else
-    info.server_ip = client->server_ip;
+    info.server_ip = g_strdup (client->server_ip);
 
   /* create an SDP for the media object */
   if (!gst_rtsp_sdp_from_media (sdp, &info, media))
     goto no_sdp;
 
+  g_free (info.server_ip);
+
   return sdp;
 
   /* ERRORS */
 no_sdp:
   {
+    g_free (info.server_ip);
     gst_sdp_message_free (sdp);
     return NULL;
   }
index 6c4c005..e6ac1b2 100644 (file)
@@ -29,7 +29,7 @@ G_BEGIN_DECLS
 
 typedef struct {
   const gchar *server_proto;
-  const gchar *server_ip;
+  gchar *server_ip;
 } GstSDPInfo;
 
 /* creating SDP */