gdbm/gdbm-1.8.3-zeroheaders.patch

45 lines
1.7 KiB
Diff
Raw Normal View History

2010-03-10 14:58:34 +00:00
02_zero-headers.patch by Jeff Johnson <jbj@redhat.com> and Colin Watson <cjwatson@debian.org>
diff -urNad a/falloc.c b/falloc.c
--- a/falloc.c 2001-02-28 06:52:33.000000000 +0000
+++ b/falloc.c 2003-09-08 23:58:43.000000000 +0100
@@ -272,7 +272,7 @@
/* 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 -urNad a/gdbmopen.c b/gdbmopen.c
--- a/gdbmopen.c 2003-09-08 23:58:01.000000000 +0100
+++ b/gdbmopen.c 2003-09-08 23:58:43.000000000 +0100
@@ -212,7 +212,7 @@
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);
@@ -256,7 +256,7 @@
(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);
@@ -420,7 +420,7 @@
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;