stack dangling pointer after free stack

This commit is contained in:
2021-03-16 21:06:00 +08:00
parent 77fcced29e
commit 942770dbc9

View File

@@ -102,6 +102,7 @@ void DisplayStack(Stack *stack) {
void DestroyStack(Stack *stack) { void DestroyStack(Stack *stack) {
free(stack->data); free(stack->data);
stack->data = NULL;
stack->size = 0; stack->size = 0;
stack->top = -1; stack->top = -1;
} }