Added code to free memory

This commit is contained in:
2023-04-13 07:58:21 -05:00
parent d152c11365
commit b08416881d

View File

@@ -35,6 +35,7 @@ void stack_push(Stack* stack,void* element) {
void* stack_pop(Stack* stack) {
assert( !(stack_isEmpty(stack)) );
free(stack->data + stack->top_index);
stack->top_index--;
void* to_return = *(stack->data + stack->top_index);
*(stack->data + stack->top_index) = NULL;