mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 15:08:53 +00:00
spu-pgs: fix buffer and event leak
When playing mts files with embedded subtitles, the buffer is mapped, but not unmapped at the end resulting in a memory leak. Also unref event in handle_dvd_event as it takes ownership of the event. https://bugzilla.gnome.org/show_bug.cgi?id=753539
This commit is contained in:
parent
0812437293
commit
6fb346717b
1 changed files with 5 additions and 2 deletions
|
@ -683,6 +683,7 @@ gstspu_exec_pgs_buffer (GstDVDSpu * dvdspu, GstBuffer * buf)
|
||||||
guint8 *pos, *end;
|
guint8 *pos, *end;
|
||||||
guint8 type;
|
guint8 type;
|
||||||
guint16 packet_len;
|
guint16 packet_len;
|
||||||
|
gint remaining;
|
||||||
|
|
||||||
gst_buffer_map (buf, &map, GST_MAP_READ);
|
gst_buffer_map (buf, &map, GST_MAP_READ);
|
||||||
|
|
||||||
|
@ -703,7 +704,6 @@ gstspu_exec_pgs_buffer (GstDVDSpu * dvdspu, GstBuffer * buf)
|
||||||
pos += 2;
|
pos += 2;
|
||||||
|
|
||||||
if (pos + packet_len > end) {
|
if (pos + packet_len > end) {
|
||||||
gst_buffer_unmap (buf, &map);
|
|
||||||
PGS_DUMP ("Invalid packet length %u (only have %u bytes)\n", packet_len,
|
PGS_DUMP ("Invalid packet length %u (only have %u bytes)\n", packet_len,
|
||||||
end - pos);
|
end - pos);
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -716,7 +716,9 @@ gstspu_exec_pgs_buffer (GstDVDSpu * dvdspu, GstBuffer * buf)
|
||||||
} while (pos + 3 <= end);
|
} while (pos + 3 <= end);
|
||||||
|
|
||||||
PGS_DUMP ("End dumping command buffer with %u bytes remaining\n", end - pos);
|
PGS_DUMP ("End dumping command buffer with %u bytes remaining\n", end - pos);
|
||||||
return (pos - map.data);
|
remaining = (gint) (pos - map.data);
|
||||||
|
gst_buffer_unmap (buf, &map);
|
||||||
|
return remaining;
|
||||||
|
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
error:
|
error:
|
||||||
|
@ -777,6 +779,7 @@ gstspu_pgs_render (GstDVDSpu * dvdspu, GstVideoFrame * frame)
|
||||||
gboolean
|
gboolean
|
||||||
gstspu_pgs_handle_dvd_event (GstDVDSpu * dvdspu, GstEvent * event)
|
gstspu_pgs_handle_dvd_event (GstDVDSpu * dvdspu, GstEvent * event)
|
||||||
{
|
{
|
||||||
|
gst_event_unref (event);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue