Project

General

Profile

Bug #1872

a bug in chunkqueue_remove_empty_last_chunk

Added by liming over 10 years ago. Updated almost 10 years ago.

Status:
Fixed
Priority:
Normal
Assignee:
-
Category:
core
Target version:
Start date:
2009-01-15
Due date:
% Done:

0%

Estimated time:
Missing in 1.5.x:
No

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;

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

History

#1

Updated by liming almost 10 years ago

I found this bug has been fixed, please close it

#2

Updated by icy almost 10 years ago

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

Thanks :)

#3

Updated by stbuehler almost 10 years ago

Was applied in revision r2514

Also available in: Atom