summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Toso <victortoso@redhat.com>2015-08-19 12:05:46 +0200
committerVictor Toso <victortoso@redhat.com>2015-10-08 08:26:34 +0200
commit5677a08c8050d664a6362bd2528be4ab3c60188c (patch)
tree327ae2034956be3f82a447dc3fd76a829add93e8
parent67faf19b40c8a58b8965602103398caf5c8386a3 (diff)
char-device: free all memory pool when no clientsfix-char-device-leaks
When no client is connect we should not need to keep the memory pool used by char-device. On most situations this is not significante but when using webdav this could mean freeing MAX_POOL_SIZE bytes Related: https://bugs.freedesktop.org/show_bug.cgi?id=91350
-rw-r--r--server/char_device.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/server/char_device.c b/server/char_device.c
index 5eda89c..d757d9b 100644
--- a/server/char_device.c
+++ b/server/char_device.c
@@ -826,6 +826,12 @@ void spice_char_device_client_remove(SpiceCharDeviceState *dev,
dev->wait_for_migrate_data = FALSE;
spice_char_device_read_from_device(dev);
}
+
+ if (dev->num_clients == 0) {
+ spice_debug("client removed, memory pool will be freed (%lu bytes)", dev->cur_pool_size);
+ write_buffers_queue_free(&dev->write_bufs_pool);
+ dev->cur_pool_size = 0;
+ }
}
int spice_char_device_client_exists(SpiceCharDeviceState *dev,