svn commit: samba r24641 - in branches/SAMBA_4_0/source/ntvfs/posix: .

tridge at samba.org tridge at samba.org
Fri Aug 24 02:35:48 GMT 2007


Author: tridge
Date: 2007-08-24 02:35:46 +0000 (Fri, 24 Aug 2007)
New Revision: 24641

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

Log:

fixed several memory leaks in the brlock code

Modified:
   branches/SAMBA_4_0/source/ntvfs/posix/pvfs_lock.c


Changeset:
Modified: branches/SAMBA_4_0/source/ntvfs/posix/pvfs_lock.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/pvfs_lock.c	2007-08-24 01:57:54 UTC (rev 24640)
+++ branches/SAMBA_4_0/source/ntvfs/posix/pvfs_lock.c	2007-08-24 02:35:46 UTC (rev 24641)
@@ -155,6 +155,7 @@
 		if (timed_out) {
 			/* no more chances */
 			pvfs_lock_async_failed(pvfs, req, f, locks, pending->pending_lock, status);
+			talloc_free(pending);
 		} else {
 			/* we can try again */
 			DLIST_ADD(f->pending_list, pending);
@@ -192,6 +193,7 @@
 									 pending);
 				if (pending->wait_handle == NULL) {
 					pvfs_lock_async_failed(pvfs, req, f, locks, i, NT_STATUS_NO_MEMORY);
+					talloc_free(pending);
 				} else {
 					talloc_steal(pending, pending->wait_handle);
 					DLIST_ADD(f->pending_list, pending);
@@ -199,6 +201,7 @@
 				return;
 			}
 			pvfs_lock_async_failed(pvfs, req, f, locks, i, status);
+			talloc_free(pending);
 			return;
 		}
 
@@ -208,6 +211,7 @@
 	/* we've managed to get all the locks. Tell the client */
 	req->async_states->status = NT_STATUS_OK;
 	req->async_states->send_fn(req);
+	talloc_free(pending);
 }
 
 
@@ -323,17 +327,20 @@
 	}
 
 	if (lck->lockx.in.mode & LOCKING_ANDX_CANCEL_LOCK) {
+		talloc_free(pending);
 		return pvfs_lock_cancel(pvfs, req, lck, f);
 	}
 
 	if (lck->lockx.in.mode & LOCKING_ANDX_CHANGE_LOCKTYPE) {
 		/* this seems to not be supported by any windows server,
 		   or used by any clients */
+		talloc_free(pending);
 		return NT_STATUS_DOS(ERRDOS, ERRnoatomiclocks);
 	}
 
 	if (lck->lockx.in.mode & LOCKING_ANDX_OPLOCK_RELEASE) {
 		DEBUG(0,("received unexpected oplock break\n"));
+		talloc_free(pending);
 		return NT_STATUS_NOT_IMPLEMENTED;
 	}
 
@@ -348,6 +355,7 @@
 				    locks[i].offset,
 				    locks[i].count);
 		if (!NT_STATUS_IS_OK(status)) {
+			talloc_free(pending);
 			return status;
 		}
 		f->lock_count--;
@@ -375,6 +383,7 @@
 									 pvfs_pending_lock_continue,
 									 pending);
 				if (pending->wait_handle == NULL) {
+					talloc_free(pending);
 					return NT_STATUS_NO_MEMORY;
 				}
 				talloc_steal(pending, pending->wait_handle);
@@ -394,10 +403,12 @@
 					   locks[i].count);
 				f->lock_count--;
 			}
+			talloc_free(pending);
 			return status;
 		}
 		f->lock_count++;
 	}
 
+	talloc_free(pending);
 	return NT_STATUS_OK;
 }



More information about the samba-cvs mailing list