summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2009-03-13 16:19:41 +0100
committerWim Taymans <wim.taymans@collabora.co.uk>2009-03-13 16:19:41 +0100
commitf4b7cbbf1639776a4c066b04462bed13d22d02ae (patch)
treeecc5c02703990c7b0c4f603278f83a331e3ec5a9
parente863e4ed1b38bdd50cdad9efcdb217a9213ff9b3 (diff)
rtsp: fix resolving of hostnames
We were returning a pointer to a stack variable with the resolved hostname, which doesn't work. return a copy of the resolved ip address instead. Fixes #575256.
-rw-r--r--gst-libs/gst/rtsp/gstrtspconnection.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/gst-libs/gst/rtsp/gstrtspconnection.c b/gst-libs/gst/rtsp/gstrtspconnection.c
index 8849eac5..fd60a04d 100644
--- a/gst-libs/gst/rtsp/gstrtspconnection.c
+++ b/gst-libs/gst/rtsp/gstrtspconnection.c
@@ -386,7 +386,7 @@ accept_failed:
}
}
-static const gchar *
+static gchar *
do_resolve (const gchar * host)
{
struct hostent *hostinfo;
@@ -421,7 +421,7 @@ do_resolve (const gchar * host)
sizeof (ipbuf));
#endif /* G_OS_WIN32 */
}
- return ip;
+ return g_strdup (ip);
/* ERRORS */
not_resolved:
@@ -535,7 +535,7 @@ setup_tunneling (GstRTSPConnection * conn, GTimeVal * timeout)
guint idx, line;
gint retval;
GstClockTime to;
- const gchar *ip;
+ gchar *ip;
guint16 port;
gchar codestr[4], *resultstr;
gint code;
@@ -649,6 +649,7 @@ setup_tunneling (GstRTSPConnection * conn, GTimeVal * timeout)
/* connect to the host/port */
res = do_connect (ip, port, &conn->fd1, conn->fdset, timeout);
+ g_free (ip);
if (res != GST_RTSP_OK)
goto connect_failed;
@@ -738,7 +739,7 @@ GstRTSPResult
gst_rtsp_connection_connect (GstRTSPConnection * conn, GTimeVal * timeout)
{
GstRTSPResult res;
- const gchar *ip;
+ gchar *ip;
guint16 port;
GstRTSPUrl *url;
@@ -760,7 +761,7 @@ gst_rtsp_connection_connect (GstRTSPConnection * conn, GTimeVal * timeout)
goto connect_failed;
g_free (conn->ip);
- conn->ip = g_strdup (ip);
+ conn->ip = ip;
/* this is our read URL */
conn->readfd = &conn->fd0;
@@ -783,6 +784,7 @@ not_resolved:
connect_failed:
{
GST_ERROR ("failed to connect");
+ g_free (ip);
return res;
}
tunneling_failed: