From: Oliver Kurth Date: Fri, 15 Sep 2017 18:22:44 +0000 (-0700) Subject: Fix some leaks found by valgrind. X-Git-Tag: stable-10.2.0~700 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=08c8209dfb01ff07d82ba1e1cdbe26ead51ba5d9;p=thirdparty%2Fopen-vm-tools.git Fix some leaks found by valgrind. - leaking the 'data' pref value for a log handler. - leaking an rpc message response if the caller doesn't want it. - leaking username/password for every guestOp --- diff --git a/open-vm-tools/lib/rpcChannel/rpcChannel.c b/open-vm-tools/lib/rpcChannel/rpcChannel.c index 39cd63cea..9eb7f3109 100644 --- a/open-vm-tools/lib/rpcChannel/rpcChannel.c +++ b/open-vm-tools/lib/rpcChannel/rpcChannel.c @@ -896,6 +896,8 @@ done: if (result != NULL) { *result = res; + } else { + free(res); } if (resultLen != NULL) { *resultLen = resLen; diff --git a/open-vm-tools/libvmtools/vmtoolsLog.c b/open-vm-tools/libvmtools/vmtoolsLog.c index 381797ac4..647ec48c1 100644 --- a/open-vm-tools/libvmtools/vmtoolsLog.c +++ b/open-vm-tools/libvmtools/vmtoolsLog.c @@ -875,6 +875,7 @@ VMToolsConfigLogDomain(const gchar *domain, exit: g_free(handler); g_free(level); + g_free(confData); } diff --git a/open-vm-tools/services/plugins/vix/vixTools.c b/open-vm-tools/services/plugins/vix/vixTools.c index 4c0995b12..aa8538a30 100644 --- a/open-vm-tools/services/plugins/vix/vixTools.c +++ b/open-vm-tools/services/plugins/vix/vixTools.c @@ -11327,8 +11327,8 @@ GuestAuthPasswordAuthenticateImpersonate( { #if SUPPORT_VGAUTH VixError err; - char *username; - char *password; + char *username = NULL; + char *password = NULL; VGAuthContext *ctx = NULL; VGAuthError vgErr; VGAuthUserHandle *newHandle = NULL; @@ -11377,6 +11377,8 @@ GuestAuthPasswordAuthenticateImpersonate( err = VIX_OK; done: + free(username); + Util_ZeroFreeString(password); return err; #else