From: Oliver Kurth Date: Fri, 15 Sep 2017 18:23:43 +0000 (-0700) Subject: Hgfs Server: Fix a memory leak on server exit not destroying the shares X-Git-Tag: stable-10.2.0~175 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=21dc0516201085e760d831d187b5232acf3a17d0;p=thirdparty%2Fopen-vm-tools.git Hgfs Server: Fix a memory leak on server exit not destroying the shares 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. --- diff --git a/open-vm-tools/lib/hgfsServer/hgfsServer.c b/open-vm-tools/lib/hgfsServer/hgfsServer.c index 31733218d..1087000dc 100644 --- a/open-vm-tools/lib/hgfsServer/hgfsServer.c +++ b/open-vm-tools/lib/hgfsServer/hgfsServer.c @@ -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__);