char-device: free all memory pool when no clients

When no client is connect we should not need to keep the memory pool
used by char-device. In most situations this is not significant but
when using webdav this could mean freeing MAX_POOL_SIZE bytes

Related: https://bugs.freedesktop.org/show_bug.cgi?id=91350
This commit is contained in:
Victor Toso 2015-08-19 12:05:46 +02:00
parent 2832fdf25a
commit a263c651e1

View File

@ -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,