media: don't leak the destination address
authorWim Taymans <wim.taymans@collabora.co.uk>
Tue, 26 May 2009 17:05:07 +0000 (19:05 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Tue, 26 May 2009 17:07:33 +0000 (19:07 +0200)
gst/rtsp-server/rtsp-media.c

index fe322bc..82a5fd8 100644 (file)
@@ -713,18 +713,19 @@ find_transport (GstRTSPMediaStream *stream, const gchar *rtcp_from)
 {
   GList *walk;
   GstRTSPMediaTrans *result = NULL;
-  const gchar *dest;
+  const gchar *tmp;
+  gchar *dest;
   guint port;
 
   if (rtcp_from == NULL)
     return NULL;
 
-  dest = g_strrstr (rtcp_from, ":");
-  if (dest == NULL)
+  tmp = g_strrstr (rtcp_from, ":");
+  if (tmp == NULL)
     return NULL;
 
-  port = atoi (dest + 1);
-  dest = g_strndup (rtcp_from, dest - rtcp_from);
+  port = atoi (tmp + 1);
+  dest = g_strndup (rtcp_from, tmp - rtcp_from);
 
   g_message ("finding %s:%d", dest, port);
 
@@ -740,6 +741,8 @@ find_transport (GstRTSPMediaStream *stream, const gchar *rtcp_from)
       break;
     }
   }
+  g_free (dest);
+
   return result;
 }