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

Dirk Hohndel dirk at hohndel.org
Thu Dec 28 16:35:42 PST 2017


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 4f87f6fcd14a..e4d118fac4f8 100644
--- a/src/mares_darwin.c
+++ b/src/mares_darwin.c
@@ -331,7 +331,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 990f46657bdb..bc7f5d97be99 100644
--- a/src/mares_iconhd.c
+++ b/src/mares_iconhd.c
@@ -609,7 +609,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