You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by jw...@apache.org on 2003/12/06 02:26:22 UTC

cvs commit: apr-util/misc apr_rmm.c

jwoolley    2003/12/05 17:26:22

  Modified:    misc     apr_rmm.c
  Log:
  fix some bugs in the find_block_of_size() function which would cause
  it to be more or less completely broken if the size requested was
  very close to the size of the block it found to allocate from
  
  Submitted by: Kevin Wang <xwang_tech yahoo.com>
  Reviewed by:  Cliff Woolley
  
  Revision  Changes    Path
  1.21      +2 -2      apr-util/misc/apr_rmm.c
  
  Index: apr_rmm.c
  ===================================================================
  RCS file: /home/cvs/apr-util/misc/apr_rmm.c,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -d -u -r1.20 -r1.21
  --- apr_rmm.c	21 Apr 2003 18:42:02 -0000	1.20
  +++ apr_rmm.c	6 Dec 2003 01:26:21 -0000	1.21
  @@ -126,7 +126,7 @@
           next = blk->next;
       }
   
  -    if (bestsize - size > sizeof(struct rmm_block_t*)) {
  +    if (bestsize - size > sizeof(rmm_block_t)) {
           struct rmm_block_t *blk = (rmm_block_t*)((char*)rmm->base + best);
           struct rmm_block_t *new = (rmm_block_t*)((char*)rmm->base + best + size);
   
  @@ -138,7 +138,7 @@
           blk->next = best + size;
   
           if (new->next) {
  -            blk = (rmm_block_t*)((char*)rmm->base + blk->next);
  +            blk = (rmm_block_t*)((char*)rmm->base + new->next);
               blk->prev = best + size;
           }
       }