[spice-gtk,v1,5/6] spice-gstaudio: fix GTask leak on query for volume

Submitted by Victor Toso on Sept. 2, 2019, 4:04 p.m.

Details

Message ID 20190902160449.19589-6-victortoso@redhat.com
State New
Headers show
Series "Initialize GStreamer on SpiceSession" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Victor Toso Sept. 2, 2019, 4:04 p.m.
From: Victor Toso <me@victortoso.com>

 > 184 bytes in 1 blocks are definitely lost in loss record 12,668 of 14,231
 >    at 0x483880B: malloc (vg_replace_malloc.c:309)
 >    by 0x4A64C98: g_malloc (in /usr/lib64/libglib-2.0.so.0.6000.6)
 >    by 0x4A7CFB5: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.6000.6)
 >    by 0x4A7D5DD: g_slice_alloc0 (in /usr/lib64/libglib-2.0.so.0.6000.6)
 >    by 0x4D3E061: g_type_create_instance (in /usr/lib64/libgobject-2.0.so.0.6000.6)
 >    by 0x4D2042C: ??? (in /usr/lib64/libgobject-2.0.so.0.6000.6)
 >    by 0x4D21B14: g_object_new_with_properties (in /usr/lib64/libgobject-2.0.so.0.6000.6)
 >    by 0x4D226C0: g_object_new (in /usr/lib64/libgobject-2.0.so.0.6000.6)
 >    by 0x4BE0FB8: g_task_new (in /usr/lib64/libgio-2.0.so.0.6000.6)
 >    by 0x48EDFCB: spice_gstaudio_get_record_volume_info_async (spice-gstaudio.c:679)
 >    by 0x48C2A4F: spice_audio_get_record_volume_info_async (spice-audio.c:212)
 >    by 0x48B2F00: agent_sync_audio_record (channel-main.c:1285)
 >
 > 240 (184 direct, 56 indirect) bytes in 1 blocks are definitely lost in loss record 12,889 of 14,231
 >    at 0x483880B: malloc (vg_replace_malloc.c:309)
 >    by 0x4A64C98: g_malloc (in /usr/lib64/libglib-2.0.so.0.6000.6)
 >    by 0x4A7CFB5: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.6000.6)
 >    by 0x4A7D5DD: g_slice_alloc0 (in /usr/lib64/libglib-2.0.so.0.6000.6)
 >    by 0x4D3E061: g_type_create_instance (in /usr/lib64/libgobject-2.0.so.0.6000.6)
 >    by 0x4D2042C: ??? (in /usr/lib64/libgobject-2.0.so.0.6000.6)
 >    by 0x4D21B14: g_object_new_with_properties (in /usr/lib64/libgobject-2.0.so.0.6000.6)
 >    by 0x4D226C0: g_object_new (in /usr/lib64/libgobject-2.0.so.0.6000.6)
 >    by 0x4BE0FB8: g_task_new (in /usr/lib64/libgio-2.0.so.0.6000.6)
 >    by 0x48EDAF9: spice_gstaudio_get_playback_volume_info_async (spice-gstaudio.c:597)
 >    by 0x48C2967: spice_audio_get_playback_volume_info_async (spice-audio.c:189)
 >    by 0x48B2C33: agent_sync_audio_playback (channel-main.c:1229)

Signed-off-by: Victor Toso <victortoso@redhat.com>
---
 src/spice-gstaudio.c | 2 ++
 1 file changed, 2 insertions(+)

Patch hide | download patch | download mbox

diff --git a/src/spice-gstaudio.c b/src/spice-gstaudio.c
index 9be647b..9e9fd49 100644
--- a/src/spice-gstaudio.c
+++ b/src/spice-gstaudio.c
@@ -597,6 +597,7 @@  static void spice_gstaudio_get_playback_volume_info_async(SpiceAudio *audio,
     GTask *task = g_task_new(audio, cancellable, callback, user_data);
 
     g_task_return_boolean(task, TRUE);
+    g_object_unref(task);
 }
 
 static gboolean spice_gstaudio_get_playback_volume_info_finish(SpiceAudio *audio,
@@ -679,6 +680,7 @@  static void spice_gstaudio_get_record_volume_info_async(SpiceAudio *audio,
     GTask *task = g_task_new(audio, cancellable, callback, user_data);
 
     g_task_return_boolean(task, TRUE);
+    g_object_unref(task);
 }
 
 static gboolean spice_gstaudio_get_record_volume_info_finish(SpiceAudio *audio,

Comments

On 9/2/19 1:04 PM, Victor Toso wrote:
> From: Victor Toso <me@victortoso.com>
> 
>  > 184 bytes in 1 blocks are definitely lost in loss record 12,668 of 14,231
>  >    at 0x483880B: malloc (vg_replace_malloc.c:309)
>  >    by 0x4A64C98: g_malloc (in /usr/lib64/libglib-2.0.so.0.6000.6)
>  >    by 0x4A7CFB5: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.6000.6)
>  >    by 0x4A7D5DD: g_slice_alloc0 (in /usr/lib64/libglib-2.0.so.0.6000.6)
>  >    by 0x4D3E061: g_type_create_instance (in /usr/lib64/libgobject-2.0.so.0.6000.6)
>  >    by 0x4D2042C: ??? (in /usr/lib64/libgobject-2.0.so.0.6000.6)
>  >    by 0x4D21B14: g_object_new_with_properties (in /usr/lib64/libgobject-2.0.so.0.6000.6)
>  >    by 0x4D226C0: g_object_new (in /usr/lib64/libgobject-2.0.so.0.6000.6)
>  >    by 0x4BE0FB8: g_task_new (in /usr/lib64/libgio-2.0.so.0.6000.6)
>  >    by 0x48EDFCB: spice_gstaudio_get_record_volume_info_async (spice-gstaudio.c:679)
>  >    by 0x48C2A4F: spice_audio_get_record_volume_info_async (spice-audio.c:212)
>  >    by 0x48B2F00: agent_sync_audio_record (channel-main.c:1285)
>  >
>  > 240 (184 direct, 56 indirect) bytes in 1 blocks are definitely lost in loss record 12,889 of 14,231
>  >    at 0x483880B: malloc (vg_replace_malloc.c:309)
>  >    by 0x4A64C98: g_malloc (in /usr/lib64/libglib-2.0.so.0.6000.6)
>  >    by 0x4A7CFB5: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.6000.6)
>  >    by 0x4A7D5DD: g_slice_alloc0 (in /usr/lib64/libglib-2.0.so.0.6000.6)
>  >    by 0x4D3E061: g_type_create_instance (in /usr/lib64/libgobject-2.0.so.0.6000.6)
>  >    by 0x4D2042C: ??? (in /usr/lib64/libgobject-2.0.so.0.6000.6)
>  >    by 0x4D21B14: g_object_new_with_properties (in /usr/lib64/libgobject-2.0.so.0.6000.6)
>  >    by 0x4D226C0: g_object_new (in /usr/lib64/libgobject-2.0.so.0.6000.6)
>  >    by 0x4BE0FB8: g_task_new (in /usr/lib64/libgio-2.0.so.0.6000.6)
>  >    by 0x48EDAF9: spice_gstaudio_get_playback_volume_info_async (spice-gstaudio.c:597)
>  >    by 0x48C2967: spice_audio_get_playback_volume_info_async (spice-audio.c:189)
>  >    by 0x48B2C33: agent_sync_audio_playback (channel-main.c:1229)
> 
> Signed-off-by: Victor Toso <victortoso@redhat.com>
> ---
>  src/spice-gstaudio.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/spice-gstaudio.c b/src/spice-gstaudio.c
> index 9be647b..9e9fd49 100644
> --- a/src/spice-gstaudio.c
> +++ b/src/spice-gstaudio.c
> @@ -597,6 +597,7 @@ static void spice_gstaudio_get_playback_volume_info_async(SpiceAudio *audio,
>      GTask *task = g_task_new(audio, cancellable, callback, user_data);
>  
>      g_task_return_boolean(task, TRUE);
> +    g_object_unref(task);
>  }
>  
>  static gboolean spice_gstaudio_get_playback_volume_info_finish(SpiceAudio *audio,
> @@ -679,6 +680,7 @@ static void spice_gstaudio_get_record_volume_info_async(SpiceAudio *audio,
>      GTask *task = g_task_new(audio, cancellable, callback, user_data);
>  
>      g_task_return_boolean(task, TRUE);
> +    g_object_unref(task);
>  }
>  
>  static gboolean spice_gstaudio_get_record_volume_info_finish(SpiceAudio *audio,
> 

I've been there as well, GTask API is a bit tricky. :)

Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>