[gnome-remote-desktop] vnc: Unref frame when success is FALSE



commit 24a3466e17db2af6415010b2d8cc1a8f56c1b962
Author: Pascal Nowack <Pascal Nowack gmx de>
Date:   Mon Jan 31 13:45:22 2022 +0100

    vnc: Unref frame when success is FALSE
    
    Otherwise, the frame is leaked.

 src/grd-vnc-pipewire-stream.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/src/grd-vnc-pipewire-stream.c b/src/grd-vnc-pipewire-stream.c
index 2acb4305..f4bbc9f7 100644
--- a/src/grd-vnc-pipewire-stream.c
+++ b/src/grd-vnc-pipewire-stream.c
@@ -578,7 +578,7 @@ on_frame_ready (GrdVncPipeWireStream *stream,
       grd_vnc_frame_unref (pending_frame);
     }
 
-  stream->pending_frame = frame;
+  stream->pending_frame = g_steal_pointer (&frame);
 
   g_mutex_unlock (&stream->frame_mutex);
 
@@ -586,6 +586,8 @@ out:
   pw_stream_queue_buffer (stream->pipewire_stream, buffer);
 
   g_source_set_ready_time (stream->pending_frame_source, 0);
+
+  g_clear_pointer (&frame, grd_vnc_frame_unref);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]