From bb94f8150d9971651299bf6f7b578080c553708f Mon Sep 17 00:00:00 2001 From: Nathan French Date: Tue, 27 Mar 2018 14:20:40 -0400 Subject: [PATCH] [#81] use mutex_destroy on refcount.h --- refcount.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/refcount.h b/refcount.h index 9905897..ecc5ccd 100644 --- a/refcount.h +++ b/refcount.h @@ -1,8 +1,11 @@ #pragma once +#include +#include +#include #include -static void (* REF_free)(void *) = free; +static void (*REF_free)(void *) = free; static void * (* REF_realloc)(void *, size_t) = realloc; static void * (* REF_malloc)(size_t) = malloc; @@ -25,8 +28,9 @@ static inline void ref_init_functions(void *(*mallocf)(size_t), void * (*callocf)(size_t, size_t), void *(*reallocf)(void *, size_t), - void (* freef)(void *)) + 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); } });