ben 96/12/14 12:28:47
Modified: src alloc.c Log: Fix bug in palloc() on sizes <= 0. Reviewed by: Rob Hartill, Chuck Murcko, Randy Terbush Revision Changes Path 1.20 +6 -3 apache/src/alloc.c Index: alloc.c =================================================================== RCS file: /export/home/cvs/apache/src/alloc.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C3 -r1.19 -r1.20 *** alloc.c 1996/12/01 20:28:10 1.19 --- alloc.c 1996/12/14 20:28:45 1.20 *************** *** 100,106 **** ! /* Get a completely new block from the system pool */ union block_hdr *malloc_block (int size) { --- 100,107 ---- ! /* Get a completely new block from the system pool. Note that we rely on ! malloc() to provide aligned memory. */ union block_hdr *malloc_block (int size) { *************** *** 338,344 **** int nclicks = 1 + ((reqsize - 1) / CLICK_SZ); int size = nclicks * CLICK_SZ; ! /* First, see if we have space in the block most recently * allocated to this pool */ --- 339,345 ---- int nclicks = 1 + ((reqsize - 1) / CLICK_SZ); int size = nclicks * CLICK_SZ; ! /* First, see if we have space in the block most recently * allocated to this pool */ *************** *** 347,353 **** char *first_avail = blok->h.first_avail; char *new_first_avail; ! if (size <= 0) size = 1; new_first_avail = first_avail + size; if (new_first_avail <= blok->h.endp) { --- 348,356 ---- char *first_avail = blok->h.first_avail; char *new_first_avail; ! if(reqsize <= 0) ! return NULL; ! new_first_avail = first_avail + size; if (new_first_avail <= blok->h.endp) {