summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2007-08-24 02:35:46 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:02:28 -0500
commit10d8f0086ba950de206f74cbdf062caeee913fde (patch)
tree5bd1f1e5a86aa159c6a1d714d31e291e310a5a1e
parent2da0be9d5e3e7bd91c145031a0bc238a010a9e97 (diff)
downloadsamba-10d8f0086ba950de206f74cbdf062caeee913fde.tar.gz
samba-10d8f0086ba950de206f74cbdf062caeee913fde.tar.bz2
samba-10d8f0086ba950de206f74cbdf062caeee913fde.zip
r24641: fixed several memory leaks in the brlock code
(This used to be commit aa0a3489646ee0ce9d69e4c57c60f83e4894c8a3)
-rw-r--r--source4/ntvfs/posix/pvfs_lock.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/source4/ntvfs/posix/pvfs_lock.c b/source4/ntvfs/posix/pvfs_lock.c
index bf17ceb83b..989e3c56a4 100644
--- a/source4/ntvfs/posix/pvfs_lock.c
+++ b/source4/ntvfs/posix/pvfs_lock.c
@@ -155,6 +155,7 @@ static void pvfs_pending_lock_continue(void *private, enum pvfs_wait_notice reas
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 @@ static void pvfs_pending_lock_continue(void *private, enum pvfs_wait_notice reas
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 @@ static void pvfs_pending_lock_continue(void *private, enum pvfs_wait_notice reas
return;
}
pvfs_lock_async_failed(pvfs, req, f, locks, i, status);
+ talloc_free(pending);
return;
}
@@ -208,6 +211,7 @@ static void pvfs_pending_lock_continue(void *private, enum pvfs_wait_notice reas
/* 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 @@ NTSTATUS pvfs_lock(struct ntvfs_module_context *ntvfs,
}
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 @@ NTSTATUS pvfs_lock(struct ntvfs_module_context *ntvfs,
locks[i].offset,
locks[i].count);
if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(pending);
return status;
}
f->lock_count--;
@@ -375,6 +383,7 @@ NTSTATUS pvfs_lock(struct ntvfs_module_context *ntvfs,
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 @@ NTSTATUS pvfs_lock(struct ntvfs_module_context *ntvfs,
locks[i].count);
f->lock_count--;
}
+ talloc_free(pending);
return status;
}
f->lock_count++;
}
+ talloc_free(pending);
return NT_STATUS_OK;
}