From: Oliver Kurth Date: Mon, 28 Oct 2019 23:12:39 +0000 (-0700) Subject: Fix minor NULL check in DataMap_Copy function. X-Git-Tag: stable-11.1.0~201 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3600232a34c14aa308c6511569f5cec783017eea;p=thirdparty%2Fopen-vm-tools.git Fix minor NULL check in DataMap_Copy function. One of the code scanners identified the following issue in DataMap_Copy function. """ Either the condition 'src==NULL' is redundant or there is possible null pointer dereference: src. """ Fixed the issue by moving the NULL check to the top of the function. --- diff --git a/open-vm-tools/lib/dataMap/dataMap.c b/open-vm-tools/lib/dataMap/dataMap.c index b76abcd53..067cfe05e 100644 --- a/open-vm-tools/lib/dataMap/dataMap.c +++ b/open-vm-tools/lib/dataMap/dataMap.c @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2012-2017 VMware, Inc. All rights reserved. + * Copyright (C) 2012-2017,2019 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 @@ -1719,13 +1719,13 @@ DataMap_Copy(const DataMap *src, // IN ClientData clientData; ErrorCode res; - ASSERT(src->map != NULL); - ASSERT(src->cookie == magic_cookie); - if (src == NULL || dst == NULL) { return DMERR_INVALID_ARGS; } + ASSERT(src->map != NULL); + ASSERT(src->cookie == magic_cookie); + /* init dst map */ res = DataMap_Create(dst); if (res != DMERR_SUCCESS) {