Blame SOURCES/0002-Fix-leaks-in-ListAliases-and-ListMappedAliases.patch

afff29
From 1128cfce9031891ff0da50131b75771582756ca1 Mon Sep 17 00:00:00 2001
afff29
From: Oliver Kurth <okurth@vmware.com>
afff29
Date: Wed, 2 Oct 2019 17:48:35 -0700
afff29
Subject: Fix leaks in ListAliases and ListMappedAliases.
afff29
afff29
The 'record' for each alias was being leaked.
afff29
---
afff29
 open-vm-tools/services/plugins/vix/vixTools.c | 10 ++++++++--
afff29
 1 file changed, 8 insertions(+), 2 deletions(-)
afff29
afff29
diff --git a/open-vm-tools/services/plugins/vix/vixTools.c b/open-vm-tools/services/plugins/vix/vixTools.c
afff29
index 44bca5c..c40ad15 100644
afff29
--- a/open-vm-tools/services/plugins/vix/vixTools.c
afff29
+++ b/open-vm-tools/services/plugins/vix/vixTools.c
afff29
@@ -9762,7 +9762,6 @@ VixToolsListAuthAliases(VixCommandRequestHeader *requestMsg, // IN
afff29
    char *destPtr;
afff29
    char *endDestPtr;
afff29
    char *tmpBuf = NULL;
afff29
-   char *recordBuf;
afff29
    size_t recordSize;
afff29
    char *escapedStr = NULL;
afff29
    char *escapedStr2 = NULL;
afff29
@@ -9822,6 +9821,8 @@ VixToolsListAuthAliases(VixCommandRequestHeader *requestMsg, // IN
afff29
    destPtr += Str_Sprintf(destPtr, endDestPtr - destPtr, "%s",
afff29
                           VIX_XML_ESCAPED_TAG);
afff29
    for (i = 0; i < num; i++) {
afff29
+      char *recordBuf = NULL;
afff29
+
afff29
       escapedStr = VixToolsEscapeXMLString(uaList[i].pemCert);
afff29
       if (escapedStr == NULL) {
afff29
          err = VIX_E_OUT_OF_MEMORY;
afff29
@@ -9895,6 +9896,8 @@ VixToolsListAuthAliases(VixCommandRequestHeader *requestMsg, // IN
afff29
          Log("%s: ListAuth list results too large, truncating", __FUNCTION__);
afff29
          goto abort;
afff29
       }
afff29
+      free(recordBuf);
afff29
+      recordBuf = NULL;
afff29
    }
afff29
 
afff29
    *result = resultBuffer;
afff29
@@ -9960,7 +9963,6 @@ VixToolsListMappedAliases(VixCommandRequestHeader *requestMsg, // IN
afff29
    char *destPtr;
afff29
    char *endDestPtr;
afff29
    char *tmpBuf = NULL;
afff29
-   char *recordBuf;
afff29
    char *escapedStr = NULL;
afff29
    char *escapedStr2 = NULL;
afff29
    size_t recordSize;
afff29
@@ -10014,6 +10016,8 @@ VixToolsListMappedAliases(VixCommandRequestHeader *requestMsg, // IN
afff29
    destPtr += Str_Sprintf(destPtr, endDestPtr - destPtr, "%s",
afff29
                           VIX_XML_ESCAPED_TAG);
afff29
    for (i = 0; i < num; i++) {
afff29
+      char *recordBuf = NULL;
afff29
+
afff29
       escapedStr = VixToolsEscapeXMLString(maList[i].pemCert);
afff29
       if (escapedStr == NULL) {
afff29
          err = VIX_E_OUT_OF_MEMORY;
afff29
@@ -10085,6 +10089,8 @@ VixToolsListMappedAliases(VixCommandRequestHeader *requestMsg, // IN
afff29
          Log("%s: ListMapped results too large, truncating", __FUNCTION__);
afff29
          goto abort;
afff29
       }
afff29
+      free(recordBuf);
afff29
+      recordBuf = NULL;
afff29
    }
afff29
 
afff29
    *result = resultBuffer;
afff29
-- 
afff29
1.8.3.1
afff29