From: Oliver Kurth Date: Tue, 30 Apr 2019 20:24:24 +0000 (-0700) Subject: Fix memory leak in SNEBuildHash function. X-Git-Tag: stable-11.0.0~109 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1b755d3e619ed40d8750532f10af5a1df6de6cda;p=thirdparty%2Fopen-vm-tools.git Fix memory leak in SNEBuildHash function. In a specific code path of the SNEBuildHash function, when the environment variable is of the format VMWARE_*=[0|1], the value is not freed. Fixed the memory leak. --- diff --git a/open-vm-tools/lib/system/systemLinux.c b/open-vm-tools/lib/system/systemLinux.c index c74d48901..7d9798ab7 100644 --- a/open-vm-tools/lib/system/systemLinux.c +++ b/open-vm-tools/lib/system/systemLinux.c @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 1998-2018 VMware, Inc. All rights reserved. + * Copyright (C) 1998-2019 VMware, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -607,6 +607,8 @@ SNEBuildHash(const char **compatEnviron) char *realValue = (value[0] == '0') ? NULL : Util_SafeStrdup(&value[1]); + free(value); + value = NULL; HashTable_ReplaceOrInsert(environTable, realKey, realValue); } else { HashTable_LookupOrInsert(environTable, key, value);