[gnome-remote-desktop] rdp-pipewire-stream: Also clear pending frame, when destroying stream



commit c3ea5b3cbbc997e815c9d5592b91c86bd45a0d27
Author: Pascal Nowack <Pascal Nowack gmx de>
Date:   Tue Sep 28 13:07:11 2021 +0200

    rdp-pipewire-stream: Also clear pending frame, when destroying stream
    
    Currently, when the PipeWire stream is destroyed, there could still be
    a pending frame, that won't be encoded any more.
    In such case, the frame data is leaked.
    
    So, fix this by freeing the pending frame data, when the stream is
    destroyed.

 src/grd-rdp-pipewire-stream.c | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/src/grd-rdp-pipewire-stream.c b/src/grd-rdp-pipewire-stream.c
index ba8050a..e2f3cae 100644
--- a/src/grd-rdp-pipewire-stream.c
+++ b/src/grd-rdp-pipewire-stream.c
@@ -612,6 +612,13 @@ grd_rdp_pipewire_stream_finalize (GObject *object)
       g_clear_pointer (&stream->render_source, g_source_unref);
     }
 
+  if (stream->pending_frame)
+    {
+      g_free (stream->pending_frame->data);
+      g_free (stream->pending_frame->pointer_bitmap);
+      g_clear_pointer (&stream->pending_frame, g_free);
+    }
+
   G_OBJECT_CLASS (grd_rdp_pipewire_stream_parent_class)->finalize (object);
 }
 


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