summaryrefslogtreecommitdiff
path: root/source3/locking
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-07-15 00:05:47 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:19:21 -0500
commitad673ea988cdfe2b596f128e616f7cd57fedf33d (patch)
tree436cd7c32ea25e84025b4f6d86d2fb69d260fd22 /source3/locking
parentd22d540c326f4964566f1c3dcb72df7986782215 (diff)
downloadsamba-ad673ea988cdfe2b596f128e616f7cd57fedf33d.tar.gz
samba-ad673ea988cdfe2b596f128e616f7cd57fedf33d.tar.bz2
samba-ad673ea988cdfe2b596f128e616f7cd57fedf33d.zip
r17043: Fix memleak when processing CIFS POSIX lock/unlock
requests. Maybe the Linux kernel OOM killer will be kinder to smbd now :-). Back to tdbtorture tests on cifsfs. Jeremy. (This used to be commit 1201383e7ab2413795a395491af0a4d3877b1c8b)
Diffstat (limited to 'source3/locking')
-rw-r--r--source3/locking/brlock.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c
index 376c2e30ba..c048ef3005 100644
--- a/source3/locking/brlock.c
+++ b/source3/locking/brlock.c
@@ -666,6 +666,7 @@ static NTSTATUS brl_lock_posix(struct byte_range_lock *br_lck,
return NT_STATUS_NO_MEMORY;
}
br_lck->num_locks = count;
+ SAFE_FREE(br_lck->lock_data);
br_lck->lock_data = (void *)tp;
br_lck->modified = True;
return NT_STATUS_OK;
@@ -977,6 +978,7 @@ static BOOL brl_unlock_posix(struct byte_range_lock *br_lck, const struct lock_s
}
br_lck->num_locks = count;
+ SAFE_FREE(br_lck->lock_data);
br_lck->lock_data = (void *)tp;
br_lck->modified = True;
@@ -1052,7 +1054,7 @@ BOOL brl_locktest(struct byte_range_lock *br_lck,
BOOL ret = True;
unsigned int i;
struct lock_struct lock;
- struct lock_struct *locks = (struct lock_struct *)br_lck->lock_data;
+ const struct lock_struct *locks = (struct lock_struct *)br_lck->lock_data;
files_struct *fsp = br_lck->fsp;
lock.context.smbpid = smbpid;
@@ -1109,7 +1111,7 @@ NTSTATUS brl_lockquery(struct byte_range_lock *br_lck,
{
unsigned int i;
struct lock_struct lock;
- struct lock_struct *locks = (struct lock_struct *)br_lck->lock_data;
+ const struct lock_struct *locks = (struct lock_struct *)br_lck->lock_data;
files_struct *fsp = br_lck->fsp;
lock.context.smbpid = *psmbpid;
@@ -1123,7 +1125,7 @@ NTSTATUS brl_lockquery(struct byte_range_lock *br_lck,
/* Make sure existing locks don't conflict */
for (i=0; i < br_lck->num_locks; i++) {
- struct lock_struct *exlock = &locks[i];
+ const struct lock_struct *exlock = &locks[i];
BOOL conflict = False;
if (exlock->lock_flav == WINDOWS_LOCK) {
@@ -1163,7 +1165,6 @@ NTSTATUS brl_lockquery(struct byte_range_lock *br_lck,
return NT_STATUS_OK;
}
-
/****************************************************************************
Remove a particular pending lock.
****************************************************************************/