diff options
author | Yoann Lopes <yoann.lopes@qt.io> | 2016-12-10 15:58:58 +0200 |
---|---|---|
committer | Yoann Lopes <yoann.lopes@qt.io> | 2016-12-12 12:14:13 +0000 |
commit | c39e5411cb5bf3e1e09f1e0bf9cf3a6387022e75 (patch) | |
tree | 3b8d1e30574da839f18cfeb81cfd0d8d15597376 | |
parent | 2304c5b38a9efe861f7d4e4e0518fcb82532450f (diff) |
GStreamer: fix a memory leak in the media player session
A gchar* was never freed.
Change-Id: Ib28fee3d13839bf15a9216bdcd5da68b6d1f904c
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
-rw-r--r-- | src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp index 09b74148e..67bfa628f 100644 --- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp +++ b/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp @@ -1894,12 +1894,14 @@ void QGstreamerPlayerSession::playlistTypeFindFunction(GstTypeFind *find, gpoint { QGstreamerPlayerSession* session = (QGstreamerPlayerSession*)userData; - const gchar *uri = 0; + gchar *strval = 0; #if GST_CHECK_VERSION(1,0,0) - g_object_get(G_OBJECT(session->m_playbin), "current-uri", &uri, NULL); + g_object_get(G_OBJECT(session->m_playbin), "current-uri", &strval, NULL); #else - g_object_get(G_OBJECT(session->m_playbin), "uri", &uri, NULL); + g_object_get(G_OBJECT(session->m_playbin), "uri", &strval, NULL); #endif + const QString uri(QString::fromUtf8(strval)); + g_free(strval); guint64 length = gst_type_find_get_length(find); if (!length) @@ -1910,7 +1912,7 @@ void QGstreamerPlayerSession::playlistTypeFindFunction(GstTypeFind *find, gpoint while (length > 0) { const guint8 *data = gst_type_find_peek(find, 0, length); if (data) { - session->m_isPlaylist = (QPlaylistFileParser::findPlaylistType(QString::fromUtf8(uri), 0, data, length) != QPlaylistFileParser::UNKNOWN); + session->m_isPlaylist = (QPlaylistFileParser::findPlaylistType(uri, 0, data, length) != QPlaylistFileParser::UNKNOWN); return; } length >>= 1; // for HTTP files length is not available, |