diff --git a/codes/c/chapter_hashing/hash_map_open_addressing.c b/codes/c/chapter_hashing/hash_map_open_addressing.c index ffcb2d980..55dadd85d 100644 --- a/codes/c/chapter_hashing/hash_map_open_addressing.c +++ b/codes/c/chapter_hashing/hash_map_open_addressing.c @@ -49,6 +49,9 @@ void delHashMapOpenAddressing(HashMapOpenAddressing *hashMap) { free(pair); } } + free(hashMap->buckets); + free(hashMap->TOMBSTONE); + free(hashMap); } /* 哈希函数 */ diff --git a/codes/c/chapter_stack_and_queue/linkedlist_deque.c b/codes/c/chapter_stack_and_queue/linkedlist_deque.c index 53569ec6f..f28671683 100644 --- a/codes/c/chapter_stack_and_queue/linkedlist_deque.c +++ b/codes/c/chapter_stack_and_queue/linkedlist_deque.c @@ -122,8 +122,8 @@ int pop(LinkedListDeque *deque, bool isFront) { if (fNext) { fNext->prev = NULL; deque->front->next = NULL; - delDoublyListNode(deque->front); } + delDoublyListNode(deque->front); deque->front = fNext; // 更新头节点 } // 队尾出队操作 @@ -133,8 +133,8 @@ int pop(LinkedListDeque *deque, bool isFront) { if (rPrev) { rPrev->next = NULL; deque->rear->prev = NULL; - delDoublyListNode(deque->rear); } + delDoublyListNode(deque->rear); deque->rear = rPrev; // 更新尾节点 } deque->queSize--; // 更新队列长度