summaryrefslogtreecommitdiffabout
path: root/src/falloc.c
Side-by-side diff
Diffstat (limited to 'src/falloc.c') (more/less context) (ignore whitespace changes)
-rw-r--r--src/falloc.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/falloc.c b/src/falloc.c
index 3f437a6..33a238a 100644
--- a/src/falloc.c
+++ b/src/falloc.c
@@ -152,7 +152,7 @@ _gdbm_free (GDBM_FILE dbf, off_t file_adr, int num_bytes)
/* Gets the avail block at the top of the stack and loads it into the
- active avail block. It does a "free" for itself! This can (and is)
+ active avail block. It does a "free" for itself! This can be (and is)
now called even when the avail block is not empty, so we must be
smart about things. */
@@ -206,12 +206,19 @@ pop_avail_block (GDBM_FILE dbf)
return -1;
}
+ if (!gdbm_avail_block_valid_p (new_blk))
+ {
+ gdbm_set_errno (dbf, GDBM_BAD_AVAIL, TRUE);
+ _gdbm_fatal (dbf, gdbm_db_strerror (dbf));
+ return -1;
+ }
+
/* Add the elements from the new block to the header. */
index = 0;
while (index < new_blk->count)
{
- while(index < new_blk->count
- && dbf->header->avail.count < dbf->header->avail.size)
+ while (index < new_blk->count
+ && dbf->header->avail.count < dbf->header->avail.size)
{
/* With luck, this will merge a lot of blocks! */
_gdbm_put_av_elem (new_blk->av_table[index],

Return to:

Send suggestions and report system problems to the System administrator.