[qtmultimedia] Fixed memory leak in QGstreamerPlayerSession. Fixes JB#41822

==25456== 83 bytes in 1 blocks are definitely lost in loss record 7,587 of 8,690
==25456==    at 0x483F3EC: malloc (vg_replace_malloc.c:299)
==25456==    by 0x5AF00DF: g_malloc (gmem.c:94)
==25456==    by 0x5B07185: g_strdup (gstrfuncs.c:363)
==25456==    by 0x5A87EC3: value_lcopy_string (gvaluetypes.c:312)
==25456==    by 0x5A6B607: g_object_get_valist (gobject.c:2234)
==25456==    by 0x5A6B7F3: g_object_get (gobject.c:2322)
==25456==    by 0x10241575: QGstreamerPlayerSession::playlistTypeFindFunction(_GstTypeFind*, void*) (qgstreamerplayersession.cpp:1901)
This commit is contained in:
Slava Monich
2018-05-02 15:00:10 +03:00
parent f0f5cfe307
commit f17f824b68

View File

@@ -1896,7 +1896,7 @@ void QGstreamerPlayerSession::playlistTypeFindFunction(GstTypeFind *find, gpoint
{
QGstreamerPlayerSession* session = (QGstreamerPlayerSession*)userData;
const gchar *uri = 0;
gchar *uri = 0;
#if GST_CHECK_VERSION(1,0,0)
g_object_get(G_OBJECT(session->m_playbin), "current-uri", &uri, NULL);
#else
@@ -1909,10 +1909,13 @@ void QGstreamerPlayerSession::playlistTypeFindFunction(GstTypeFind *find, gpoint
else
length = qMin(length, guint64(1024));
QString currentUri = QString::fromUtf8(uri);
g_free(uri);
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(currentUri, 0, data, length) != QPlaylistFileParser::UNKNOWN);
return;
}
length >>= 1; // for HTTP files length is not available,