]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Hgfs Server: Fix a memory leak on server exit not destroying the shares
authorOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:23:43 +0000 (11:23 -0700)
committerOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:23:43 +0000 (11:23 -0700)
This change fixes a memory leak on server exit not destroying the shares.
The list of shares is not destroyed and left.

Fix this at the Hgfs server tear down by calling the shares reset with an
empty list which will cause all shares to be treated as stale and so deleted.

open-vm-tools/lib/hgfsServer/hgfsServer.c

index 31733218d23e21cea8e91206295c2d52e273c973..1087000dc7c32aae5fa3c4c5527af62902036393 100644 (file)
@@ -3986,6 +3986,11 @@ HgfsServer_ExitState(void)
       HgfsServerOplockDestroy();
    }
    if (gHgfsDirNotifyActive) {
+      DblLnkLst_Links emptySharesList;
+      DblLnkLst_Init(&emptySharesList);
+
+      /* Make all existing shared folders stale and delete them. */
+      HgfsServerSharesReset(&emptySharesList);
       HgfsNotify_Exit();
       gHgfsDirNotifyActive = FALSE;
       Log("%s: exit notification - inactive.\n", __FUNCTION__);