From 57ffb2ba7ae83f714fdd49c9622323c3b732d153 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Tue, 7 Mar 2017 21:38:22 +0100 Subject: [PATCH] Fix some more null pointer dereferences --- src/cressi_leonardo.c | 2 +- src/usbhid.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/cressi_leonardo.c b/src/cressi_leonardo.c index 7e1df90..5259fe5 100644 --- a/src/cressi_leonardo.c +++ b/src/cressi_leonardo.c @@ -498,7 +498,7 @@ cressi_leonardo_extract_dives (dc_device_t *abstract, const unsigned char data[] } if (previous && previous != footer + 2) { - ERROR (abstract->context, "Profiles are not continuous (0x%04x 0x%04x 0x%04x).", header, footer, previous); + ERROR (context, "Profiles are not continuous (0x%04x 0x%04x 0x%04x).", header, footer, previous); free (buffer); return DC_STATUS_DATAFORMAT; } diff --git a/src/usbhid.c b/src/usbhid.c index 44c0886..0a93824 100644 --- a/src/usbhid.c +++ b/src/usbhid.c @@ -346,7 +346,7 @@ dc_usbhid_read (dc_usbhid_t *usbhid, void *data, size_t size, size_t *actual) if (usbhid == NULL) { status = DC_STATUS_INVALIDARGS; - goto out; + goto out_invalidargs; } #if defined(HAVE_LIBUSB) && !defined(__APPLE__) @@ -369,6 +369,7 @@ dc_usbhid_read (dc_usbhid_t *usbhid, void *data, size_t size, size_t *actual) out: HEXDUMP (usbhid->context, DC_LOGLEVEL_INFO, "Read", (unsigned char *) data, nbytes); +out_invalidargs: if (actual) *actual = nbytes; @@ -387,7 +388,7 @@ dc_usbhid_write (dc_usbhid_t *usbhid, const void *data, size_t size, size_t *act if (usbhid == NULL) { status = DC_STATUS_INVALIDARGS; - goto out; + goto out_invalidargs; } #if defined(HAVE_LIBUSB) && !defined(__APPLE__) @@ -410,6 +411,7 @@ dc_usbhid_write (dc_usbhid_t *usbhid, const void *data, size_t size, size_t *act out: HEXDUMP (usbhid->context, DC_LOGLEVEL_INFO, "Write", (unsigned char *) data, nbytes); +out_invalidargs: if (actual) *actual = nbytes;