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

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