|
|
a5acde |
From af8a6eab2759aafeffc5ae47aed33492eb092b51 Mon Sep 17 00:00:00 2001
|
|
|
a5acde |
From: Cathy Avery <cavery@redhat.com>
|
|
|
a5acde |
Date: Tue, 19 Nov 2019 14:16:04 +0100
|
|
|
a5acde |
Subject: [PATCH 1/3] Fix memory leaks in 'vix' tools plugin.
|
|
|
a5acde |
|
|
|
a5acde |
RH-Author: Cathy Avery <cavery@redhat.com>
|
|
|
a5acde |
Message-id: <20191119141606.5322-2-cavery@redhat.com>
|
|
|
a5acde |
Patchwork-id: 92511
|
|
|
a5acde |
O-Subject: [RHEL8.1.z open-vm-tools PATCH 1/3] Fix memory leaks in 'vix' tools plugin.
|
|
|
a5acde |
Bugzilla: 1773903
|
|
|
a5acde |
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
|
|
|
a5acde |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
a5acde |
|
|
|
a5acde |
commit 015db4c06a8be65eb96cf62421e8b5366993452f
|
|
|
a5acde |
Author: Oliver Kurth <okurth@vmware.com>
|
|
|
a5acde |
Date: Wed Aug 29 13:29:45 2018 -0700
|
|
|
a5acde |
|
|
|
a5acde |
Fix memory leaks in 'vix' tools plugin.
|
|
|
a5acde |
|
|
|
a5acde |
* vix plugin retrieves the power script file paths from the
|
|
|
a5acde |
config file but doesn't free them and this causes a memory leak.
|
|
|
a5acde |
Fixed the code to free the filepaths.
|
|
|
a5acde |
|
|
|
a5acde |
* In GuestAuthPasswordAuthenticateImpersonate function, the VGAuth
|
|
|
a5acde |
handle is not freed when the impersonation fails. Fixed the
|
|
|
a5acde |
code to call VGAuth_UserHandleFree in the error path.
|
|
|
a5acde |
|
|
|
a5acde |
Note: I executed one guest operation with wrong credentials.
|
|
|
a5acde |
Every failure leaks 75 bytes of memory. (in Centos 64-bit VM)
|
|
|
a5acde |
|
|
|
a5acde |
* Fixed another minor issue in the code. At couple of places in
|
|
|
a5acde |
the code, replaced 'err' with 'vgErr' for storing the return value
|
|
|
a5acde |
of VGAuth_UserHandleAccessToken.
|
|
|
a5acde |
|
|
|
a5acde |
Signed-off-by: Cathy Avery <cavery@redhat.com>
|
|
|
a5acde |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
a5acde |
---
|
|
|
a5acde |
services/plugins/vix/vixTools.c | 20 ++++++++++++++------
|
|
|
a5acde |
1 file changed, 14 insertions(+), 6 deletions(-)
|
|
|
a5acde |
|
|
|
a5acde |
diff --git a/services/plugins/vix/vixTools.c b/services/plugins/vix/vixTools.c
|
|
|
a5acde |
index ef26742..2d60b86 100644
|
|
|
a5acde |
--- a/services/plugins/vix/vixTools.c
|
|
|
a5acde |
+++ b/services/plugins/vix/vixTools.c
|
|
|
a5acde |
@@ -2522,10 +2522,10 @@ VixTools_GetToolsPropertiesImpl(GKeyFile *confDictRef, // IN
|
|
|
a5acde |
char *guestName;
|
|
|
a5acde |
int osFamily;
|
|
|
a5acde |
char *packageList = NULL;
|
|
|
a5acde |
- const char *powerOffScript = NULL;
|
|
|
a5acde |
- const char *powerOnScript = NULL;
|
|
|
a5acde |
- const char *resumeScript = NULL;
|
|
|
a5acde |
- const char *suspendScript = NULL;
|
|
|
a5acde |
+ char *powerOffScript = NULL;
|
|
|
a5acde |
+ char *powerOnScript = NULL;
|
|
|
a5acde |
+ char *resumeScript = NULL;
|
|
|
a5acde |
+ char *suspendScript = NULL;
|
|
|
a5acde |
char *osName = NULL;
|
|
|
a5acde |
char *osNameFull = NULL;
|
|
|
a5acde |
Bool foundHostName;
|
|
|
a5acde |
@@ -2726,6 +2726,10 @@ abort:
|
|
|
a5acde |
free(tempDir);
|
|
|
a5acde |
free(osName);
|
|
|
a5acde |
free(osNameFull);
|
|
|
a5acde |
+ free(suspendScript);
|
|
|
a5acde |
+ free(resumeScript);
|
|
|
a5acde |
+ free(powerOnScript);
|
|
|
a5acde |
+ free(powerOffScript);
|
|
|
a5acde |
#else
|
|
|
a5acde |
/*
|
|
|
a5acde |
* FreeBSD. We do not require all the properties above.
|
|
|
a5acde |
@@ -11585,7 +11589,7 @@ GuestAuthPasswordAuthenticateImpersonate(
|
|
|
a5acde |
|
|
|
a5acde |
#ifdef _WIN32
|
|
|
a5acde |
// this is making a copy of the token, be sure to close it
|
|
|
a5acde |
- err = VGAuth_UserHandleAccessToken(ctx, newHandle, userToken);
|
|
|
a5acde |
+ vgErr = VGAuth_UserHandleAccessToken(ctx, newHandle, userToken);
|
|
|
a5acde |
if (VGAUTH_FAILED(vgErr)) {
|
|
|
a5acde |
err = VixToolsTranslateVGAuthError(vgErr);
|
|
|
a5acde |
goto done;
|
|
|
a5acde |
@@ -11601,6 +11605,10 @@ done:
|
|
|
a5acde |
free(username);
|
|
|
a5acde |
Util_ZeroFreeString(password);
|
|
|
a5acde |
|
|
|
a5acde |
+ if (VIX_OK != err) {
|
|
|
a5acde |
+ VGAuth_UserHandleFree(newHandle);
|
|
|
a5acde |
+ newHandle = NULL;
|
|
|
a5acde |
+ }
|
|
|
a5acde |
return err;
|
|
|
a5acde |
#else
|
|
|
a5acde |
return VIX_E_NOT_SUPPORTED;
|
|
|
a5acde |
@@ -11731,7 +11739,7 @@ impersonate:
|
|
|
a5acde |
|
|
|
a5acde |
#ifdef _WIN32
|
|
|
a5acde |
// this is making a copy of the token, be sure to close it
|
|
|
a5acde |
- err = VGAuth_UserHandleAccessToken(ctx, newHandle, userToken);
|
|
|
a5acde |
+ vgErr = VGAuth_UserHandleAccessToken(ctx, newHandle, userToken);
|
|
|
a5acde |
if (VGAUTH_FAILED(vgErr)) {
|
|
|
a5acde |
err = VixToolsTranslateVGAuthError(vgErr);
|
|
|
a5acde |
goto done;
|
|
|
a5acde |
--
|
|
|
a5acde |
1.8.3.1
|
|
|
a5acde |
|