use mutex_destroy on refcount.h
#pragma once
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
#include <pthread.h>
static void (*REF_free)(void *) = free;
@@ -27,6 +30,7 @@ ref_init_functions(void *(*mallocf)(size_t),
void *(*reallocf)(void *, size_t),
void (*freef)(void *))
{
+ (void)callocf;
REF_malloc = mallocf;
REF_realloc = reallocf;
REF_free = freef;
@@ -79,6 +83,7 @@ ref_free(void * buf)
if (--refc->count == 0)
{
pthread_mutex_unlock(&refc->mux);
+ pthread_mutex_destroy(&refc->mux);
return REF_free(refc);
}
});
