]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Fix a potentisl memory leak in an error situation; reported by Coverity.
authorOliver Kurth <okurth@vmware.com>
Tue, 12 Nov 2019 02:12:22 +0000 (18:12 -0800)
committerOliver Kurth <okurth@vmware.com>
Tue, 12 Nov 2019 02:12:22 +0000 (18:12 -0800)
open-vm-tools/services/plugins/deployPkg/deployPkg.c

index 449ad093c15bf1e09234f6aed06c739119403150..9085a9fb8e5556ea8caa315cec65036ff518994a 100644 (file)
@@ -400,6 +400,7 @@ DeployPkgGetTempDir(void)
       free(newDir);
       if (!Random_Crypto(sizeof(randIndex), &randIndex)) {
          g_warning("%s: Random_Crypto failed\n", __FUNCTION__);
+         newDir = NULL;
          goto exit;
       }
       newDir = Str_Asprintf(NULL, "%s%s%08x%s",
@@ -412,9 +413,10 @@ DeployPkgGetTempDir(void)
       i++;
    }
 
-   if (found == FALSE) {
+   if (!found) {
       g_warning("%s: could not create temp directory\n", __FUNCTION__);
-      goto exit;
+      free(newDir);
+      newDir = NULL;
    }
 exit:
    free(dir);