. release a reference to a timeout source so it's properly freed.
. in the HGFS channel handling code, only initialize the channel's
connection once, since the channel is a static struct. This avoid
allocating a second transport-specific connection object (in the
init() callback) which would then be leaked.
Note that the HGFS fix is, for now, just a fix for the leak. There
are more issues with the static channel approach and the current code: for
example, the first app calling HgfsServerManager_Unregister() will shut
down the channel, instead of the last one, since the channel itself is not
ref counted.
Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
Bool success = FALSE;
struct HgfsGuestConn *connData = NULL;
- if (channel->ops->init(serverCBTable, mgrData->rpc, mgrData->rpcCallback, &connData)) {
+ if (channel->connection == NULL &&
+ channel->ops->init(serverCBTable, mgrData->rpc, mgrData->rpcCallback, &connData)) {
channel->state |= HGFS_CHANNEL_STATE_CBINIT;
channel->connection = connData;
success = TRUE;
TimeSync_DisableTimeSlew();
g_source_destroy(data->timer);
+ g_source_unref(data->timer);
data->timer = NULL;
data->state = TIMESYNC_STOPPED;