aboutsummaryrefslogtreecommitdiffstats
path: root/P1/src/reducer.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--P1/src/reducer.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/P1/src/reducer.c b/P1/src/reducer.c
index bdf093b..7afb9ee 100644
--- a/P1/src/reducer.c
+++ b/P1/src/reducer.c
@@ -33,11 +33,11 @@ finalKeyValueDS *insertNewKeyValue(finalKeyValueDS *root, char *word, int count)
void freeFinalDS(finalKeyValueDS *root) {
if(root == NULL) return;
- finalKeyValueDS *tempNode = root -> next;;
- while (tempNode != NULL){
- free(root);
- root = tempNode;
- tempNode = tempNode -> next;
+ finalKeyValueDS *tempNode = NULL;
+ while (root != NULL) {
+ tempNode = root;
+ root = root -> next;
+ free(tempNode);
}
}