Blame SOURCES/ovt-Fix-memory-leak-in-SNEBuildHash-function.patch

604589
From ce0aed0b753b24891cf33463f69e0ceb953b826f Mon Sep 17 00:00:00 2001
604589
From: Cathy Avery <cavery@redhat.com>
604589
Date: Thu, 25 Jul 2019 12:32:28 +0200
604589
Subject: [PATCH 05/16] Fix memory leak in SNEBuildHash function.
604589
604589
RH-Author: Cathy Avery <cavery@redhat.com>
604589
Message-id: <20190725123239.18274-6-cavery@redhat.com>
604589
Patchwork-id: 89716
604589
O-Subject: [RHEL8.1 open-vm-tools PATCH 05/16] Fix memory leak in SNEBuildHash function.
604589
Bugzilla: 1602648
604589
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
604589
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
604589
604589
commit 1b755d3e619ed40d8750532f10af5a1df6de6cda
604589
Author: Oliver Kurth <okurth@vmware.com>
604589
Date:   Tue Apr 30 13:24:24 2019 -0700
604589
604589
    Fix memory leak in SNEBuildHash function.
604589
604589
    In a specific code path of the SNEBuildHash function, when the
604589
    environment variable is of the format VMWARE_*=[0|1], the value
604589
    is not freed.  Fixed the memory leak.
604589
604589
Signed-off-by: Cathy Avery <cavery@redhat.com>
604589
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
604589
---
604589
 open-vm-tools/lib/system/systemLinux.c | 4 +++-
604589
 1 file changed, 3 insertions(+), 1 deletion(-)
604589
604589
diff --git a/lib/system/systemLinux.c b/lib/system/systemLinux.c
604589
index c74d489..7d9798a 100644
604589
--- a/lib/system/systemLinux.c
604589
+++ b/lib/system/systemLinux.c
604589
@@ -1,5 +1,5 @@
604589
 /*********************************************************
604589
- * Copyright (C) 1998-2018 VMware, Inc. All rights reserved.
604589
+ * Copyright (C) 1998-2019 VMware, Inc. All rights reserved.
604589
  *
604589
  * This program is free software; you can redistribute it and/or modify it
604589
  * under the terms of the GNU Lesser General Public License as published
604589
@@ -607,6 +607,8 @@ SNEBuildHash(const char **compatEnviron)
604589
          char *realValue = (value[0] == '0')
604589
                            ? NULL
604589
                            : Util_SafeStrdup(&value[1]);
604589
+         free(value);
604589
+         value = NULL;
604589
          HashTable_ReplaceOrInsert(environTable, realKey, realValue);
604589
       } else {
604589
          HashTable_LookupOrInsert(environTable, key, value);
604589
-- 
604589
1.8.3.1
604589