]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Fix dereference after null check reported by Coverity.
authorJohn Wolfe <jwolfe@vmware.com>
Mon, 5 Apr 2021 16:01:42 +0000 (09:01 -0700)
committerJohn Wolfe <jwolfe@vmware.com>
Mon, 5 Apr 2021 16:01:42 +0000 (09:01 -0700)
Removed a NULL pointer test for gErr that causes Coverity to report
a dereference after null check.

open-vm-tools/libvmtools/vmtoolsConfig.c

index 1e77a8014aaea10f2e1dc742163b8f230581af25..89d37e8b0bf4f6dc947a51d34d794678f0b68f3b 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 2008-2020 VMware, Inc. All rights reserved.
+ * Copyright (C) 2008-2021 VMware, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU Lesser General Public License as published
@@ -360,18 +360,20 @@ VMTools_CompareConfig(GKeyFile *config1,
          }
 
          value1 = g_key_file_get_value(config1, group, key, &gErr);
-         if (value1 == NULL && gErr != NULL) {
+         if (value1 == NULL) {
             g_warning("%s: g_key_file_get_value(%s:%s) for first config "
                       "failed: %s\n",
-                      __FUNCTION__, group, key, gErr->message);
+                      __FUNCTION__, group, key,
+                      (gErr != NULL) ? gErr->message : "");
             goto mismatch;
          }
 
          value2 = g_key_file_get_value(config2, group, key, &gErr);
-         if (value2 == NULL && gErr != NULL) {
+         if (value2 == NULL) {
             g_warning("%s: g_key_file_get_value(%s:%s) for second config "
                       "failed: %s\n",
-                      __FUNCTION__, group, key, gErr->message);
+                      __FUNCTION__, group, key,
+                      (gErr != NULL) ? gErr->message : "");
             goto mismatch;
          }