diff --git a/src/UDPC_Deque.c b/src/UDPC_Deque.c index 35a76a8..6dff813 100644 --- a/src/UDPC_Deque.c +++ b/src/UDPC_Deque.c @@ -20,11 +20,10 @@ UDPC_Deque* UDPC_Deque_init(uint32_t alloc_size) } } -void UDPC_Deque_destroy(UDPC_Deque **deque) +void UDPC_Deque_destroy(UDPC_Deque *deque) { - free((*deque)->buf); - free(*deque); - *deque = NULL; + free(deque->buf); + free(deque); } int UDPC_Deque_realloc(UDPC_Deque *deque, uint32_t new_size) diff --git a/src/UDPC_Deque.h b/src/UDPC_Deque.h index 6c8a6ca..14929f1 100644 --- a/src/UDPC_Deque.h +++ b/src/UDPC_Deque.h @@ -20,7 +20,7 @@ UDPC_Deque* UDPC_Deque_init(uint32_t alloc_size); /*! * Frees resources used by a UDPC_Deque */ -void UDPC_Deque_destroy(UDPC_Deque **deque); +void UDPC_Deque_destroy(UDPC_Deque *deque); /*! * Fails if new_size is smaller than current size of Deque. diff --git a/src/test/UDPC_UnitTest.c b/src/test/UDPC_UnitTest.c index 22be834..2090dc6 100644 --- a/src/test/UDPC_UnitTest.c +++ b/src/test/UDPC_UnitTest.c @@ -171,7 +171,7 @@ int main() deque->alloc_size, deque->size, deque->head, deque->tail); */ - UDPC_Deque_destroy(&deque); + UDPC_Deque_destroy(deque); UNITTEST_REPORT() return 0; }