summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Hervey <edward@collabora.com>2014-05-13 11:51:55 +0200
committerEdward Hervey <edward@collabora.com>2014-05-13 11:53:41 +0200
commit1ca576c240e2fb013012706f11e201953b6c10d6 (patch)
tree472273f55d33972ccab21cc6796d808bbfbddd76
parente0cfd6e26b53b9530b0a3494b883c490714b8da7 (diff)
rtspconnection: Don't use argument for local storage
By re-using the uri argument for storing local data, we could end up in a situation where we would free uri ... which would actually be the string passed in argument. Instead explicitely use a local variable. Fixes double-free issues. CID #1212176
-rw-r--r--gst-libs/gst/rtsp/gstrtspconnection.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/gst-libs/gst/rtsp/gstrtspconnection.c b/gst-libs/gst/rtsp/gstrtspconnection.c
index 592de83648..b4f5b4fb60 100644
--- a/gst-libs/gst/rtsp/gstrtspconnection.c
+++ b/gst-libs/gst/rtsp/gstrtspconnection.c
@@ -636,6 +636,7 @@ setup_tunneling (GstRTSPConnection * conn, GTimeVal * timeout, gchar * uri)
GError *error = NULL;
GSocketConnection *connection;
GSocket *socket;
+ gchar *luri = NULL;
memset (&response, 0, sizeof (response));
gst_rtsp_message_init (&response);
@@ -689,7 +690,7 @@ setup_tunneling (GstRTSPConnection * conn, GTimeVal * timeout, gchar * uri)
}
gst_rtsp_url_get_port (url, &url_port);
- uri = g_strdup_printf ("http://%s:%d%s%s%s", url->host, url_port,
+ luri = g_strdup_printf ("http://%s:%d%s%s%s", url->host, url_port,
url->abspath, url->query ? "?" : "", url->query ? url->query : "");
/* connect to the host/port */
@@ -698,7 +699,7 @@ setup_tunneling (GstRTSPConnection * conn, GTimeVal * timeout, gchar * uri)
conn->proxy_host, conn->proxy_port, conn->cancellable, &error);
} else {
connection = g_socket_client_connect_to_uri (conn->client,
- uri, 0, conn->cancellable, &error);
+ luri, 0, conn->cancellable, &error);
}
if (connection == NULL)
goto connect_failed;
@@ -720,7 +721,7 @@ setup_tunneling (GstRTSPConnection * conn, GTimeVal * timeout, gchar * uri)
conn->control_stream = NULL;
/* create the POST request for the write connection */
- GST_RTSP_CHECK (gst_rtsp_message_new_request (&msg, GST_RTSP_POST, uri),
+ GST_RTSP_CHECK (gst_rtsp_message_new_request (&msg, GST_RTSP_POST, luri),
no_message);
msg->type = GST_RTSP_MESSAGE_HTTP_REQUEST;
@@ -743,7 +744,7 @@ setup_tunneling (GstRTSPConnection * conn, GTimeVal * timeout, gchar * uri)
exit:
gst_rtsp_message_unset (&response);
- g_free (uri);
+ g_free (luri);
return res;