thread = zmalloc(sizeof(*thread));
if (!thread) {
- goto error;
+ goto error_alloc;
}
urcu_ref_init(&thread->ref);
/* Release list reference. */
lttng_thread_put(thread);
pthread_mutex_unlock(&thread_list.lock);
-error:
/* Release initial reference. */
lttng_thread_put(thread);
+error_alloc:
return NULL;
}
void lttng_thread_put(struct lttng_thread *thread)
{
+ if (!thread) {
+ return;
+ }
assert(thread->ref.refcount);
urcu_ref_put(&thread->ref, lttng_thread_release);
}
if (ret) {
PERROR("Failed to join \"%s\" thread", thread->name);
result = false;
+ goto end;
}
/* Release the list's reference to the thread. */
cds_list_del(&thread->node);