[PATCH 14/14] Cleanup: remove confusing NULL check

Dirk Hohndel dirk at hohndel.org
Wed Jan 3 11:35:17 PST 2018


device has already been dereferenced before we ever get here

Coverity CID 207713
Coverity CID 207780

Signed-off-by: Dirk Hohndel <dirk at hohndel.org>
---
 src/mares_darwin.c | 2 +-
 src/mares_iconhd.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mares_darwin.c b/src/mares_darwin.c
index 308477cda6b6..e5716a9610a8 100644
--- a/src/mares_darwin.c
+++ b/src/mares_darwin.c
@@ -332,7 +332,7 @@ mares_darwin_extract_dives (dc_device_t *abstract, const unsigned char data[], u
 			current -= length;
 		}
 
-		if (device && memcmp (buffer, device->fingerprint, sizeof (device->fingerprint)) == 0) {
+		if (memcmp (buffer, device->fingerprint, sizeof (device->fingerprint)) == 0) {
 			free (buffer);
 			return DC_STATUS_SUCCESS;
 		}
diff --git a/src/mares_iconhd.c b/src/mares_iconhd.c
index b56da27a5b8a..90e49634cf19 100644
--- a/src/mares_iconhd.c
+++ b/src/mares_iconhd.c
@@ -610,7 +610,7 @@ mares_iconhd_device_foreach (dc_device_t *abstract, dc_dive_callback_t callback,
 			break;
 
 		unsigned char *fp = buffer + offset + length - headersize + fingerprint;
-		if (device && memcmp (fp, device->fingerprint, sizeof (device->fingerprint)) == 0) {
+		if (memcmp (fp, device->fingerprint, sizeof (device->fingerprint)) == 0) {
 			break;
 		}
 
-- 
2.15.1



More information about the devel mailing list