]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commit
Hgfs Server Manager Tools: fix a memory leak
authorOliver Kurth <okurth@vmware.com>
Tue, 19 Feb 2019 20:51:33 +0000 (12:51 -0800)
committerOliver Kurth <okurth@vmware.com>
Tue, 19 Feb 2019 20:51:33 +0000 (12:51 -0800)
commit34e9b02de740562802680ab43b8dfd3e741b0658
treeb2891c9bbc0c4dc7f2b68ae5a4019c3176518f37
parent19609ecdf97dbdbfa116eb3129689850fbf3e528
Hgfs Server Manager Tools: fix a memory leak

The Hgfs server manager interface assumes that it is called only once
for each application that uses it.  However, in the tools services there
are multiple clients.  Hence, the initialization is done multiple times
and causes the previous initializations which allocate resources to be
overwritten and lost.  Thus memory is being leaked.

Initialize the policy shares once on the first register and cleanup
the policy shares on final unregister by introducing a reference count.

The channel is already reference counted and initializes the channel once.
However it is necessary to call the channel init on each register
and exit on each unregister as it saves a channel reference in the data manager
object passed to it by the caller for subsequent retrieval.

Add an additional log to the policy init and cleanup calls for tracking purposes.
open-vm-tools/lib/hgfsServerManagerGuest/hgfsServerManagerGuest.c
open-vm-tools/lib/hgfsServerPolicyGuest/hgfsServerPolicyGuest.c