[Bug 768158] New: waylandsink : memory leak of gst_wayland_sink_get_caps() and scaler of wldisplay
GStreamer (GNOME Bugzilla)
bugzilla at gnome.org
Wed Jun 29 02:12:33 UTC 2016
https://bugzilla.gnome.org/show_bug.cgi?id=768158
Bug ID: 768158
Summary: waylandsink : memory leak of
gst_wayland_sink_get_caps() and scaler of wldisplay
Classification: Platform
Product: GStreamer
Version: 1.8.2
OS: Linux
Status: NEW
Severity: critical
Priority: Normal
Component: gst-plugins-bad
Assignee: gstreamer-bugs at lists.freedesktop.org
Reporter: hyunil46.park at samsung.com
QA Contact: gstreamer-bugs at lists.freedesktop.org
GNOME version: ---
There are memory leak.
I find these memory leak by valgrind tool.
First,
Gvalue list and value of gst_wayland_sink_get_caps() are local variable.
&value is allocated on heap memory by g_value_set_string() and &list is
allocated on heap memory by gst_value_list_append_value().
but these allocated memory is not free after use.
we need to add g_value_unset (&list) and g_value_unset (&value);
Second,
scaler is not destroyed after use.
We need to add wl_scaler_destroy (self->scaler) on gst_wl_display_finalize().
After fix as below, all definitely issue is removed.
diff --git a/ext/wayland/gstwaylandsink.c b/ext/wayland/gstwaylandsink.c
index 5d59525..02e9a3c 100644
--- a/ext/wayland/gstwaylandsink.c
+++ b/ext/wayland/gstwaylandsink.c
@@ -409,6 +409,8 @@ gst_wayland_sink_get_caps (GstBaseSink * bsink, GstCaps *
filter)
gst_structure_set_value (gst_caps_get_structure (caps, 0), "format",
&list);
GST_DEBUG_OBJECT (sink, "display caps: %" GST_PTR_FORMAT, caps);
+ g_value_unset (&list);
+ g_value_unset (&value);
}
g_mutex_unlock (&sink->display_lock);
diff --git a/ext/wayland/wldisplay.c b/ext/wayland/wldisplay.c
index 3318095..a28e310 100644
--- a/ext/wayland/wldisplay.c
+++ b/ext/wayland/wldisplay.c
@@ -81,6 +81,9 @@ gst_wl_display_finalize (GObject * gobject)
if (self->shell)
wl_shell_destroy (self->shell);
+ if (self->scaler)
+ wl_scaler_destroy (self->scaler);
+
if (self->compositor)
wl_compositor_destroy (self->compositor);
[valgrind log]
==5512== 1,620 (140 direct, 1,480 indirect) bytes in 5 blocks are definitely
lost in loss record 2,642 of 2,708
==5512== at 0x4845750: malloc (vg_replace_malloc.c:296)
==5512== by 0x49C6EC1: g_malloc (gmem.c:97)
==5512== by 0x49D67D1: g_slice_alloc (gslice.c:1007)
==5512== by 0x49A360B: g_array_sized_new (garray.c:193)
==5512== by 0x48F2A39: gst_value_init_list_or_array (gstvalue.c:284)
==5512== by 0x496D195: g_value_init (gvalue.c:175)
==5512== by 0x682E453: ??? (in /usr/lib/gstreamer-1.0/libgstwaylandsink.so)
==5512== 25 bytes in 5 blocks are definitely lost in loss record 1,627 of 2,708
==5512== at 0x4845750: malloc (vg_replace_malloc.c:296)
==5512== by 0x49C6EC1: g_malloc (gmem.c:97)
==5512== by 0x49D786D: g_strdup (gstrfuncs.c:356)
==5512== by 0x496FC0F: g_value_set_string (gvaluetypes.c:1038)
==5512== by 0x682E4EF: ??? (in /usr/lib/gstreamer-1.0/libgstwaylandsink.so)
==5512== 40 bytes in 1 blocks are definitely lost in loss record 1,880 of 2,708
==5512== at 0x4847E64: calloc (vg_replace_malloc.c:623)
==5512== by 0x67C83CB: ??? (in /usr/lib/libwayland-client.so.0.3.0)
==5512== by 0x67C8763: wl_proxy_marshal_array_constructor_versioned (in
/usr/lib/libwayland-client.so.0.3.0)
==5512== by 0x67C88E7: wl_proxy_marshal_constructor_versioned (in
/usr/lib/libwayland-client.so.0.3.0)
==5512== by 0x6833FA7: ??? (in /usr/lib/gstreamer-1.0/libgstwaylandsink.so)
--
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
More information about the gstreamer-bugs
mailing list