gdbm/gdbm-1.9.1-zeroheaders.patch
2011-09-20 14:57:06 +02:00

43 lines
1.9 KiB
Diff

diff -up gdbm-1.9.1/src/falloc.c.zeroheaders gdbm-1.9.1/src/falloc.c
--- gdbm-1.9.1/src/falloc.c.zeroheaders 2011-08-03 21:22:23.000000000 +0200
+++ gdbm-1.9.1/src/falloc.c 2011-08-24 18:23:16.876903878 +0200
@@ -255,7 +255,7 @@ push_avail_block (GDBM_FILE dbf)
/* Split the header block. */
- temp = (avail_block *) malloc (av_size);
+ temp = (avail_block *) calloc (1, av_size);
if (temp == NULL) _gdbm_fatal (dbf, "malloc error");
/* Set the size to be correct AFTER the pop_avail_block. */
temp->size = dbf->header->avail.size;
diff -up gdbm-1.9.1/src/gdbmopen.c.zeroheaders gdbm-1.9.1/src/gdbmopen.c
--- gdbm-1.9.1/src/gdbmopen.c.zeroheaders 2011-08-12 22:22:52.000000000 +0200
+++ gdbm-1.9.1/src/gdbmopen.c 2011-08-24 18:23:16.877903878 +0200
@@ -204,7 +204,7 @@ gdbm_open (const char *file, int block_s
file_block_size = block_size;
/* Get space for the file header. */
- dbf->header = (gdbm_file_header *) malloc (file_block_size);
+ dbf->header = (gdbm_file_header *) calloc (1, file_block_size);
if (dbf->header == NULL)
{
gdbm_close (dbf);
@@ -248,7 +248,7 @@ gdbm_open (const char *file, int block_s
(dbf->header->block_size - sizeof (hash_bucket))
/ sizeof (bucket_element) + 1;
dbf->header->bucket_size = dbf->header->block_size;
- dbf->bucket = (hash_bucket *) malloc (dbf->header->bucket_size);
+ dbf->bucket = (hash_bucket *) calloc (1, dbf->header->bucket_size);
if (dbf->bucket == NULL)
{
gdbm_close (dbf);
@@ -440,7 +440,7 @@ _gdbm_init_cache(GDBM_FILE dbf, size_t s
for(index = 0; index < size; index++)
{
(dbf->bucket_cache[index]).ca_bucket
- = (hash_bucket *) malloc (dbf->header->bucket_size);
+ = (hash_bucket *) calloc (1, dbf->header->bucket_size);
if ((dbf->bucket_cache[index]).ca_bucket == NULL)
{
gdbm_errno = GDBM_MALLOC_ERROR;