summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/locking/shmem.c5
-rw-r--r--source3/locking/shmem_sysv.c9
2 files changed, 8 insertions, 6 deletions
diff --git a/source3/locking/shmem.c b/source3/locking/shmem.c
index be8e22108a..6015085fe4 100644
--- a/source3/locking/shmem.c
+++ b/source3/locking/shmem.c
@@ -41,7 +41,7 @@ extern int DEBUGLEVEL;
#define SHM_FILE_MODE 0644
#endif
-#define SHMEM_HASH_SIZE 113
+#define SHMEM_HASH_SIZE 13
/* WARNING : offsets are used because mmap() does not guarantee that all processes have the
@@ -606,6 +606,9 @@ static BOOL smb_shm_free(int offset)
DEBUG(6,("smb_shm_free : freeing %d bytes at offset %d\n",header_p->size*CellSize,offset));
+ /* zero the area being freed - this allows us to find bugs faster */
+ memset(smb_shm_offset2addr(offset), 0, header_p->size*CellSize);
+
if ( scanner_p == prev_p )
{
smb_shm_header_p->statistics.cells_free += header_p->size;
diff --git a/source3/locking/shmem_sysv.c b/source3/locking/shmem_sysv.c
index 192ed32344..b57116f7b8 100644
--- a/source3/locking/shmem_sysv.c
+++ b/source3/locking/shmem_sysv.c
@@ -48,11 +48,7 @@ extern int DEBUGLEVEL;
#define SEMAPHORE_PERMS 0666
#endif
-#ifdef SEMMSL
-#define SHMEM_HASH_SIZE (SEMMSL-1)
-#else
-#define SHMEM_HASH_SIZE 63
-#endif
+#define SHMEM_HASH_SIZE 13
#define MIN_SHM_SIZE 0x1000
@@ -330,6 +326,9 @@ static BOOL shm_free(int offset)
DEBUG(6,("shm_free : freeing %d bytes at offset %d\n",
header_p->size*CellSize,offset));
+
+ /* zero the area being freed - this allows us to find bugs faster */
+ memset(shm_offset2addr(offset), 0, header_p->size*CellSize);
if (scanner_p == prev_p) {
shm_header_p->statistics.cells_free += header_p->size;