svn commit: samba r17043 - in branches/SAMBA_3_0/source/locking: .

jra at samba.org jra at samba.org
Sat Jul 15 00:05:52 GMT 2006


Author: jra
Date: 2006-07-15 00:05:47 +0000 (Sat, 15 Jul 2006)
New Revision: 17043

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17043

Log:
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.

Modified:
   branches/SAMBA_3_0/source/locking/brlock.c


Changeset:
Modified: branches/SAMBA_3_0/source/locking/brlock.c
===================================================================
--- branches/SAMBA_3_0/source/locking/brlock.c	2006-07-14 23:52:59 UTC (rev 17042)
+++ branches/SAMBA_3_0/source/locking/brlock.c	2006-07-15 00:05:47 UTC (rev 17043)
@@ -666,6 +666,7 @@
 		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 @@
 	}
 
 	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 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 @@
 {
 	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 @@
 
 	/* 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 @@
 	return NT_STATUS_OK;
 }
 
-
 /****************************************************************************
  Remove a particular pending lock.
 ****************************************************************************/



More information about the samba-cvs mailing list