aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2011-10-05 11:56:45 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2011-10-05 11:56:45 +0000
commite0db2284c372ca8be529dec2ea3e78842e5486f3 (patch)
tree32014e86ddaff26b4b3fb267a65cae2774f60a34 /src
parent3c0819116085a1a8fcae21608c388f3d5dc0531f (diff)
downloadgdbm-e0db2284c372ca8be529dec2ea3e78842e5486f3.tar.gz
gdbm-e0db2284c372ca8be529dec2ea3e78842e5486f3.tar.bz2
Initialize memory used for file header. This fixes bug #151.
Diffstat (limited to 'src')
-rw-r--r--src/gdbmopen.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gdbmopen.c b/src/gdbmopen.c
index a8a488f..3b178d2 100644
--- a/src/gdbmopen.c
+++ b/src/gdbmopen.c
@@ -210,8 +210,9 @@ gdbm_open (const char *file, int block_size, int flags, int mode,
else
file_block_size = block_size;
- /* Get space for the file header. */
- dbf->header = (gdbm_file_header *) malloc (file_block_size);
+ /* Get space for the file header. It will be written to disk, so
+ make sure there's no garbage in it. */
+ dbf->header = (gdbm_file_header *) calloc (1, file_block_size);
if (dbf->header == NULL)
{
gdbm_close (dbf);

Return to:

Send suggestions and report system problems to the System administrator.