[PATCH spice-common] marshaller: Fix a possible leak

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

 



The possible file descriptor associated to the message (currently
can be only the DRM descriptor from Virgl) is not freed in case
the marshaller is reset/destroyed.
This can happen connecting/disconnecting client.

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 common/marshaller.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/common/marshaller.c b/common/marshaller.c
index b55b568..0b45523 100644
--- a/common/marshaller.c
+++ b/common/marshaller.c
@@ -210,6 +210,12 @@ void spice_marshaller_reset(SpiceMarshaller *m)
     m->next = NULL;
     m->n_items = 0;
     m->total_size = 0;
+    if (m->has_fd) {
+        m->has_fd = false;
+        if (m->fd != -1) {
+            close(m->fd);
+        }
+    }
 
     d = m->data;
     d->last_marshaller = d->marshallers;
-- 
2.17.1

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]