mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
matroskademux: fix memory leak in check_subtitle_buffer
https://bugzilla.gnome.org/show_bug.cgi?id=704921
This commit is contained in:
parent
3c44cd7c83
commit
7335b81c47
1 changed files with 7 additions and 2 deletions
|
@ -2977,6 +2977,7 @@ gst_matroska_demux_check_subtitle_buffer (GstElement * element,
|
||||||
GstBuffer *newbuf;
|
GstBuffer *newbuf;
|
||||||
gchar *utf8;
|
gchar *utf8;
|
||||||
GstMapInfo map;
|
GstMapInfo map;
|
||||||
|
gboolean needs_unmap = TRUE;
|
||||||
|
|
||||||
sub_stream = (GstMatroskaTrackSubtitleContext *) stream;
|
sub_stream = (GstMatroskaTrackSubtitleContext *) stream;
|
||||||
|
|
||||||
|
@ -3027,10 +3028,10 @@ gst_matroska_demux_check_subtitle_buffer (GstElement * element,
|
||||||
utf8 = g_strdup ("invalid subtitle");
|
utf8 = g_strdup ("invalid subtitle");
|
||||||
|
|
||||||
newbuf = gst_buffer_new_wrapped (utf8, strlen (utf8));
|
newbuf = gst_buffer_new_wrapped (utf8, strlen (utf8));
|
||||||
|
gst_buffer_unmap (*buf, &map);
|
||||||
gst_buffer_copy_into (newbuf, *buf,
|
gst_buffer_copy_into (newbuf, *buf,
|
||||||
GST_BUFFER_COPY_TIMESTAMPS | GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_META,
|
GST_BUFFER_COPY_TIMESTAMPS | GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_META,
|
||||||
0, -1);
|
0, -1);
|
||||||
gst_buffer_unmap (*buf, &map);
|
|
||||||
gst_buffer_unref (*buf);
|
gst_buffer_unref (*buf);
|
||||||
|
|
||||||
*buf = newbuf;
|
*buf = newbuf;
|
||||||
|
@ -3047,16 +3048,20 @@ next:
|
||||||
utf8 = g_markup_escape_text ((gchar *) map.data, map.size);
|
utf8 = g_markup_escape_text ((gchar *) map.data, map.size);
|
||||||
|
|
||||||
newbuf = gst_buffer_new_wrapped (utf8, strlen (utf8));
|
newbuf = gst_buffer_new_wrapped (utf8, strlen (utf8));
|
||||||
|
gst_buffer_unmap (*buf, &map);
|
||||||
gst_buffer_copy_into (newbuf, *buf,
|
gst_buffer_copy_into (newbuf, *buf,
|
||||||
GST_BUFFER_COPY_TIMESTAMPS | GST_BUFFER_COPY_FLAGS |
|
GST_BUFFER_COPY_TIMESTAMPS | GST_BUFFER_COPY_FLAGS |
|
||||||
GST_BUFFER_COPY_META, 0, -1);
|
GST_BUFFER_COPY_META, 0, -1);
|
||||||
gst_buffer_unmap (*buf, &map);
|
|
||||||
gst_buffer_unref (*buf);
|
gst_buffer_unref (*buf);
|
||||||
|
|
||||||
*buf = newbuf;
|
*buf = newbuf;
|
||||||
|
needs_unmap = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (needs_unmap)
|
||||||
|
gst_buffer_unmap (*buf, &map);
|
||||||
|
|
||||||
return GST_FLOW_OK;
|
return GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue