Blame SOURCES/ovt-Fix-leaks-in-ListAliases-and-ListMappedAliases-9bc72.patch

378f6c
From 57a9cb6cb1f74f13af6a348443ed098927818760 Mon Sep 17 00:00:00 2001
8d58a8
From: Cathy Avery <cavery@redhat.com>
378f6c
Date: Fri, 25 Oct 2019 15:34:05 +0200
378f6c
Subject: [PATCH 3/3] Fix leaks in ListAliases and ListMappedAliases
378f6c
 (9bc72f0b09702754b429115658a85223cb3058bd from devel)
8d58a8
8d58a8
RH-Author: Cathy Avery <cavery@redhat.com>
378f6c
Message-id: <20191025153405.10241-4-cavery@redhat.com>
378f6c
Patchwork-id: 91968
378f6c
O-Subject: [RHEL7.8 open-vm-tools PATCH v2 3/3] Fix leaks in ListAliases and ListMappedAliases (9bc72f0b09702754b429115658a85223cb3058bd from devel)
378f6c
Bugzilla: 1760625
8d58a8
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
378f6c
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
8d58a8
8d58a8
commit 26b9edbeb79d1c67b9ae73a0c97c48999c1fb503 (origin/stable-10.3.10-vix-memory-leaks)
8d58a8
Author: Oliver Kurth <okurth@vmware.com>
8d58a8
Date:   Wed Oct 2 17:48:35 2019 -0700
8d58a8
8d58a8
    Fix leaks in ListAliases and ListMappedAliases (9bc72f0b09702754b429115658a85223cb3058bd from devel)
8d58a8
8d58a8
Signed-off-by: Cathy Avery <cavery@redhat.com>
8d58a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
8d58a8
---
8d58a8
 services/plugins/vix/vixTools.c | 10 ++++++++--
8d58a8
 1 file changed, 8 insertions(+), 2 deletions(-)
8d58a8
8d58a8
diff --git a/services/plugins/vix/vixTools.c b/services/plugins/vix/vixTools.c
378f6c
index 00b40b1..b0bd4d0 100644
8d58a8
--- a/services/plugins/vix/vixTools.c
8d58a8
+++ b/services/plugins/vix/vixTools.c
378f6c
@@ -9621,7 +9621,6 @@ VixToolsListAuthAliases(VixCommandRequestHeader *requestMsg, // IN
8d58a8
    char *endDestPtr;
8d58a8
    char *tmpBuf = NULL;
8d58a8
    char *tmpBuf2 = NULL;
8d58a8
-   char *recordBuf;
8d58a8
    size_t recordSize;
8d58a8
    char *escapedStr = NULL;
8d58a8
    char *escapedStr2 = NULL;
378f6c
@@ -9680,6 +9679,8 @@ VixToolsListAuthAliases(VixCommandRequestHeader *requestMsg, // IN
8d58a8
    destPtr += Str_Sprintf(destPtr, endDestPtr - destPtr, "%s",
8d58a8
                           VIX_XML_ESCAPED_TAG);
8d58a8
    for (i = 0; i < num; i++) {
8d58a8
+      char *recordBuf = NULL;
8d58a8
+
8d58a8
       escapedStr = VixToolsEscapeXMLString(uaList[i].pemCert);
8d58a8
       if (escapedStr == NULL) {
8d58a8
          err = VIX_E_OUT_OF_MEMORY;
378f6c
@@ -9750,6 +9751,8 @@ VixToolsListAuthAliases(VixCommandRequestHeader *requestMsg, // IN
8d58a8
          Log("%s: ListAuth list results too large, truncating", __FUNCTION__);
8d58a8
          goto abort;
8d58a8
       }
8d58a8
+      free(recordBuf);
8d58a8
+      recordBuf = NULL;
8d58a8
    }
8d58a8
 
8d58a8
    *result = resultBuffer;
378f6c
@@ -9817,7 +9820,6 @@ VixToolsListMappedAliases(VixCommandRequestHeader *requestMsg, // IN
8d58a8
    char *endDestPtr;
8d58a8
    char *tmpBuf = NULL;
8d58a8
    char *tmpBuf2 = NULL;
8d58a8
-   char *recordBuf;
8d58a8
    char *escapedStr = NULL;
8d58a8
    char *escapedStr2 = NULL;
8d58a8
    size_t recordSize;
378f6c
@@ -9870,6 +9872,8 @@ VixToolsListMappedAliases(VixCommandRequestHeader *requestMsg, // IN
8d58a8
    destPtr += Str_Sprintf(destPtr, endDestPtr - destPtr, "%s",
8d58a8
                           VIX_XML_ESCAPED_TAG);
8d58a8
    for (i = 0; i < num; i++) {
8d58a8
+      char *recordBuf = NULL;
8d58a8
+
8d58a8
       escapedStr = VixToolsEscapeXMLString(maList[i].pemCert);
8d58a8
       if (escapedStr == NULL) {
8d58a8
          err = VIX_E_OUT_OF_MEMORY;
378f6c
@@ -9938,6 +9942,8 @@ VixToolsListMappedAliases(VixCommandRequestHeader *requestMsg, // IN
8d58a8
          Log("%s: ListMapped results too large, truncating", __FUNCTION__);
8d58a8
          goto abort;
8d58a8
       }
8d58a8
+      free(recordBuf);
8d58a8
+      recordBuf = NULL;
8d58a8
    }
8d58a8
 
8d58a8
    *result = resultBuffer;
8d58a8
-- 
8d58a8
1.8.3.1
8d58a8