summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2010-06-07 16:26:30 -0700
committerJeremy Allison <jra@samba.org>2010-06-07 16:26:30 -0700
commit096a3d3eea60d514a5d8fe8a35b3e463238b3766 (patch)
tree5dbafe5b43da74c6ce31af2994de4324d9d1c112 /source3
parentd70413fa0cba9338fbf2adad0db6e4b88da9ad65 (diff)
downloadsamba-096a3d3eea60d514a5d8fe8a35b3e463238b3766.tar.gz
samba-096a3d3eea60d514a5d8fe8a35b3e463238b3766.tar.bz2
samba-096a3d3eea60d514a5d8fe8a35b3e463238b3766.zip
Make aio_ex owned by a talloc context, not neccessarily on the null context.
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/aio.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c
index 5354144205..bce95be149 100644
--- a/source3/smbd/aio.c
+++ b/source3/smbd/aio.c
@@ -100,9 +100,11 @@ static int aio_extra_destructor(struct aio_extra *aio_ex)
of the aio call.
*****************************************************************************/
-static struct aio_extra *create_aio_extra(files_struct *fsp, size_t buflen)
+static struct aio_extra *create_aio_extra(TALLOC_CTX *mem_ctx,
+ files_struct *fsp,
+ size_t buflen)
{
- struct aio_extra *aio_ex = TALLOC_ZERO_P(NULL, struct aio_extra);
+ struct aio_extra *aio_ex = TALLOC_ZERO_P(mem_ctx, struct aio_extra);
if (!aio_ex) {
return NULL;
@@ -112,10 +114,12 @@ static struct aio_extra *create_aio_extra(files_struct *fsp, size_t buflen)
the smb return buffer. The buffer used in the acb
is the start of the reply data portion of that buffer. */
- aio_ex->outbuf = data_blob_talloc(aio_ex, NULL, buflen);
- if (!aio_ex->outbuf.data) {
- TALLOC_FREE(aio_ex);
- return NULL;
+ if (buflen) {
+ aio_ex->outbuf = data_blob_talloc(aio_ex, NULL, buflen);
+ if (!aio_ex->outbuf.data) {
+ TALLOC_FREE(aio_ex);
+ return NULL;
+ }
}
DLIST_ADD(aio_list_head, aio_ex);
talloc_set_destructor(aio_ex, aio_extra_destructor);
@@ -175,7 +179,7 @@ NTSTATUS schedule_aio_read_and_X(connection_struct *conn,
bufsize = smb_size + 12 * 2 + smb_maxcnt;
- if ((aio_ex = create_aio_extra(fsp, bufsize)) == NULL) {
+ if ((aio_ex = create_aio_extra(NULL, fsp, bufsize)) == NULL) {
DEBUG(10,("schedule_aio_read_and_X: malloc fail.\n"));
return NT_STATUS_NO_MEMORY;
}
@@ -283,7 +287,7 @@ NTSTATUS schedule_aio_write_and_X(connection_struct *conn,
bufsize = smb_size + 6*2;
- if (!(aio_ex = create_aio_extra(fsp, bufsize))) {
+ if (!(aio_ex = create_aio_extra(NULL, fsp, bufsize))) {
DEBUG(0,("schedule_aio_write_and_X: malloc fail.\n"));
return NT_STATUS_NO_MEMORY;
}