Merge branch 'leaks-5.6' into 'mer-5.6'

Fix memory leaks

See merge request mer-core/qtmultimedia!15
This commit is contained in:
Slava Monich
2018-05-02 14:55:43 +00:00
2 changed files with 8 additions and 3 deletions

View File

@@ -301,7 +301,9 @@ bool CameraBinImageCapture::processBusMessage(const QGstreamerMessage &message)
if (!element) if (!element)
return false; return false;
QString elementName = QString::fromLatin1(gst_element_get_name(element)); gchar *name = gst_element_get_name(element);
QString elementName = QString::fromLatin1(name);
g_free(name);
#if !GST_CHECK_VERSION(1,0,0) #if !GST_CHECK_VERSION(1,0,0)
GstElementClass *elementClass = GST_ELEMENT_GET_CLASS(element); GstElementClass *elementClass = GST_ELEMENT_GET_CLASS(element);
QString elementLongName = elementClass->details.longname; QString elementLongName = elementClass->details.longname;

View File

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