From 2224a56ea44bffdafbe29ba7b74d1a0adb0cbd95 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Sun, 23 Feb 2020 01:41:56 +0100 Subject: [PATCH] Move assert()s that dereference a pointer to after the pointer NULL check. --- src/meshlink.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/meshlink.c b/src/meshlink.c index 0354c86d..fbacfd4a 100644 --- a/src/meshlink.c +++ b/src/meshlink.c @@ -1558,9 +1558,6 @@ static void *meshlink_main_loop(void *arg) { } bool meshlink_start(meshlink_handle_t *mesh) { - assert(mesh->self); - assert(mesh->private_key); - if(!mesh) { meshlink_errno = MESHLINK_EINVAL; return false; @@ -1570,6 +1567,8 @@ bool meshlink_start(meshlink_handle_t *mesh) { pthread_mutex_lock(&mesh->mutex); + assert(mesh->self); + assert(mesh->private_key); assert(mesh->self->ecdsa); assert(!memcmp((uint8_t *)mesh->self->ecdsa + 64, (uint8_t *)mesh->private_key + 64, 32)); -- 2.39.5