From: John Wolfe Date: Mon, 5 Apr 2021 16:01:42 +0000 (-0700) Subject: Fix dereference after null check reported by Coverity. X-Git-Tag: stable-11.3.0~78 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec8b7d139c72287140e660ad4f43c083981b9a6d;p=thirdparty%2Fopen-vm-tools.git Fix dereference after null check reported by Coverity. Removed a NULL pointer test for gErr that causes Coverity to report a dereference after null check. --- diff --git a/open-vm-tools/libvmtools/vmtoolsConfig.c b/open-vm-tools/libvmtools/vmtoolsConfig.c index 1e77a8014..89d37e8b0 100644 --- a/open-vm-tools/libvmtools/vmtoolsConfig.c +++ b/open-vm-tools/libvmtools/vmtoolsConfig.c @@ -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; }