Blame SOURCES/ovt-Address-Coverity-issues-reported-in-bora-lib-file-fi.patch

afff29
From d01520e206cc1e3ae658e8fb168ff3b4494fc1ef Mon Sep 17 00:00:00 2001
afff29
From: Cathy Avery <cavery@redhat.com>
afff29
Date: Tue, 3 Dec 2019 14:30:47 +0100
afff29
Subject: [PATCH 1/4] Address Coverity issues reported in bora/lib/file/file.c.
afff29
afff29
RH-Author: Cathy Avery <cavery@redhat.com>
afff29
Message-id: <20191203143050.23065-2-cavery@redhat.com>
afff29
Patchwork-id: 92833
afff29
O-Subject: [RHEL8.2 open-vm-tools PATCH 1/4] Address Coverity issues reported in bora/lib/file/file.c.
afff29
Bugzilla: 1769881
afff29
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
afff29
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
afff29
afff29
commit 5ca2850b60de0f27c3f8c565d7b7e553acc2921f
afff29
Author: Oliver Kurth <okurth@vmware.com>
afff29
Date:   Tue Aug 27 12:55:37 2019 -0700
afff29
afff29
    Address Coverity issues reported in bora/lib/file/file.c.
afff29
afff29
    Fix a minor memory leak in the function File_ExpandAndCheckDir.
afff29
    Also add annotations for unchecked return values in functions
afff29
    GetOldMachineID and File_MoveTree, so that Coverity scans of
afff29
    open-vm-tools will automatically classify these issues as
afff29
    "Intentional".  These annotations are useful both for internal
afff29
    use as well as for partners who run Coverity scans on open-vm-tools.
afff29
afff29
Signed-off-by: Cathy Avery <cavery@redhat.com>
afff29
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
afff29
---
afff29
 open-vm-tools/lib/file/file.c | 3 +++
afff29
 1 file changed, 3 insertions(+)
afff29
afff29
diff --git a/open-vm-tools/lib/file/file.c b/open-vm-tools/lib/file/file.c
afff29
index 7dae12c..774ec41 100644
afff29
--- a/open-vm-tools/lib/file/file.c
afff29
+++ b/open-vm-tools/lib/file/file.c
afff29
@@ -558,6 +558,7 @@ GetOldMachineID(void)
afff29
              sizeof hardwareID);
afff29
 
afff29
       /* Base 64 encode the binary data to obtain printable characters */
afff29
+      /* coverity[check_return] */
afff29
       Base64_Encode(rawMachineID, sizeof rawMachineID, encodedMachineID,
afff29
                     sizeof encodedMachineID, NULL);
afff29
 
afff29
@@ -1437,6 +1438,7 @@ File_MoveTree(const char *srcName,    // IN:
afff29
              * Only clean up if we created the directory.  Not attempting to
afff29
              * clean up partial failures.
afff29
              */
afff29
+            /* coverity[check_return] */
afff29
             File_DeleteDirectoryTree(dstName);
afff29
          }
afff29
       }
afff29
@@ -2186,6 +2188,7 @@ File_ExpandAndCheckDir(const char *dirName)  // IN:
afff29
 
afff29
          return edirName;
afff29
       }
afff29
+      free(edirName);
afff29
    }
afff29
 
afff29
    return NULL;
afff29
-- 
afff29
1.8.3.1
afff29