Project

General

Profile

Actions

Bug #1872

closed

a bug in chunkqueue_remove_empty_last_chunk

Added by liming about 15 years ago. Updated over 14 years ago.

Status:
Fixed
Priority:
Normal
Category:
core
Target version:
ASK QUESTIONS IN Forums:

Description

In file "chunk.c", the aim of function "chunkqueue_remove_empty_last_chunk" is to remove the last chunk, but it doesn't work correctly.

686 void chunkqueue_remove_empty_last_chunk(chunkqueue *cq) {
687     chunk *c;
688     if (!cq->last) return;
689     if (!cq->first) return;
690 
691     if (cq->first == cq->last) {
692         c = cq->first;
693 
694         if (c->type != MEM_CHUNK) return;
695         if (c->mem->used == 0) {
696             chunk_free(c);
697             cq->first = cq->last = NULL;
698         }
699         return;
700     }
701 
702     for (c = cq->first; c->next; c = c->next) {
703         if (c->type != MEM_CHUNK) continue;
704         if (c->mem->used != 0) continue;
705 
706         if (c->next == cq->last) {
707             cq->last = c;
708 
709             chunk_free(c->next);
710             c->next = NULL;
711 
712             return;
713         }
714     }
715 }

line 703~704 should be :

703         if (c->next->type != MEM_CHUNK) continue;
704         if (c->next->mem->used != 0) continue;


Files

chunk.c (12.9 KB) chunk.c liming, 2009-01-15 09:11
Actions #1

Updated by liming over 14 years ago

I found this bug has been fixed, please close it

Actions #2

Updated by icy over 14 years ago

  • Status changed from Patch Pending to Fixed
  • Missing in 1.5.x set to No

Thanks :)

Actions #3

Updated by stbuehler over 14 years ago

Was applied in revision r2514

Actions

Also available in: Atom