diff --git a/runTests.exe b/runTests.exe index 2b458d5..b73d4f9 100644 Binary files a/runTests.exe and b/runTests.exe differ diff --git a/stack.c b/stack.c index 6b63f0b..324faa4 100644 --- a/stack.c +++ b/stack.c @@ -65,11 +65,12 @@ void clearStack(StackNode *stack) while (stack != NULL) { - StackNode *next = stack->next; + StackNode *next = (stack)->next; free(stack); stack = next; - stack->data = NULL; - stack->next = NULL; - stack->prev = NULL; + (stack)->data = NULL; + (stack)->next = NULL; + (stack)->prev = NULL; } + } \ No newline at end of file diff --git a/stack.o b/stack.o index 177a3f5..ac7b1f4 100644 Binary files a/stack.o and b/stack.o differ diff --git a/test_stack.c b/test_stack.c index dd9a6ca..a5b69af 100644 --- a/test_stack.c +++ b/test_stack.c @@ -35,6 +35,7 @@ void test_clearStack(void) { testStack = push(testStack, &testInts[i]); } + //printf("testints: %d,%d,%d,%d,%d",testInts[0],testInts[1],testInts[2],testInts[3],testInts[4]); clearStack(testStack); TEST_ASSERT_NULL(testStack); diff --git a/test_stack.o b/test_stack.o index 7332b5b..aec8ef6 100644 Binary files a/test_stack.o and b/test_stack.o differ