From: Guus Sliepen Date: Sun, 23 Feb 2020 00:41:56 +0000 (+0100) Subject: Move assert()s that dereference a pointer to after the pointer NULL check. X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=2224a56ea44bffdafbe29ba7b74d1a0adb0cbd95;p=meshlink Move assert()s that dereference a pointer to after the pointer NULL check. --- 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));