From e2d98f99494ce748bd0e77d9bc1f52663936faa1 Mon Sep 17 00:00:00 2001
From: Cathy Avery <cavery@redhat.com>
Date: Fri, 15 Nov 2019 14:49:08 +0100
Subject: [PATCH 3/3] Fix leaks in ListAliases and
RH-Author: Cathy Avery <cavery@redhat.com>
Message-id: <20191115144908.7669-4-cavery@redhat.com>
Patchwork-id: 92389
O-Subject: [RHEL7.7.z open-vm-tools PATCH 3/3] Fix leaks in ListAliases and ListMappedAliases (9bc72f0b09702754b429115658a85223cb3058bd from devel)
Bugzilla: 1772825
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
RH-Acked-by: Eduardo Otubo <otubo@redhat.com>
commit 26b9edbeb79d1c67b9ae73a0c97c48999c1fb503 (origin/stable-10.3.10-vix-memory-leaks)
Author: Oliver Kurth <okurth@vmware.com>
Date: Wed Oct 2 17:48:35 2019 -0700
Fix leaks in ListAliases and ListMappedAliases (9bc72f0b09702754b429115658a85223cb3058bd from devel)
Signed-off-by: Cathy Avery <cavery@redhat.com>
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
services/plugins/vix/vixTools.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/services/plugins/vix/vixTools.c b/services/plugins/vix/vixTools.c
index 3d327e4..a30ef6b 100644
--- a/services/plugins/vix/vixTools.c
+++ b/services/plugins/vix/vixTools.c
@@ -9463,7 +9463,6 @@ VixToolsListAuthAliases(VixCommandRequestHeader *requestMsg, // IN
char *endDestPtr;
char *tmpBuf = NULL;
char *tmpBuf2 = NULL;
- char *recordBuf;
size_t recordSize;
char *escapedStr = NULL;
char *escapedStr2 = NULL;
@@ -9522,6 +9521,8 @@ VixToolsListAuthAliases(VixCommandRequestHeader *requestMsg, // IN
destPtr += Str_Sprintf(destPtr, endDestPtr - destPtr, "%s",
VIX_XML_ESCAPED_TAG);
for (i = 0; i < num; i++) {
+ char *recordBuf = NULL;
+
escapedStr = VixToolsEscapeXMLString(uaList[i].pemCert);
if (escapedStr == NULL) {
err = VIX_E_OUT_OF_MEMORY;
@@ -9592,6 +9593,8 @@ VixToolsListAuthAliases(VixCommandRequestHeader *requestMsg, // IN
Log("%s: ListAuth list results too large, truncating", __FUNCTION__);
goto abort;
}
+ free(recordBuf);
+ recordBuf = NULL;
}
*result = resultBuffer;
@@ -9659,7 +9662,6 @@ VixToolsListMappedAliases(VixCommandRequestHeader *requestMsg, // IN
char *endDestPtr;
char *tmpBuf = NULL;
char *tmpBuf2 = NULL;
- char *recordBuf;
char *escapedStr = NULL;
char *escapedStr2 = NULL;
size_t recordSize;
@@ -9712,6 +9714,8 @@ VixToolsListMappedAliases(VixCommandRequestHeader *requestMsg, // IN
destPtr += Str_Sprintf(destPtr, endDestPtr - destPtr, "%s",
VIX_XML_ESCAPED_TAG);
for (i = 0; i < num; i++) {
+ char *recordBuf = NULL;
+
escapedStr = VixToolsEscapeXMLString(maList[i].pemCert);
if (escapedStr == NULL) {
err = VIX_E_OUT_OF_MEMORY;
@@ -9780,6 +9784,8 @@ VixToolsListMappedAliases(VixCommandRequestHeader *requestMsg, // IN
Log("%s: ListMapped results too large, truncating", __FUNCTION__);
goto abort;
}
+ free(recordBuf);
+ recordBuf = NULL;
}
*result = resultBuffer;
--
1.8.3.1