summaryrefslogtreecommitdiff
path: root/source4/scripting/ejs/smbcalls_rpc.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-07-10 01:10:09 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:19:29 -0500
commit76ecf81428c161a98a5621b55a64cb8515f80585 (patch)
tree542798f01d1582b00d7d20a93effba33f98ee1fc /source4/scripting/ejs/smbcalls_rpc.c
parentc6881d1e650fd284a366af76f5a214a5de05cc0c (diff)
downloadsamba-76ecf81428c161a98a5621b55a64cb8515f80585.tar.gz
samba-76ecf81428c161a98a5621b55a64cb8515f80585.tar.bz2
samba-76ecf81428c161a98a5621b55a64cb8515f80585.zip
r8273: fixed some memory leaks in smbscript. This required converting
file_load() to use talloc, which impacted quite a few bits of code, including our smb.conf processing. took the opportunity to remove the gloabls in params.c while doing this (This used to be commit b220756cb4f1d201ba3e771ca67e4bfae5eae748)
Diffstat (limited to 'source4/scripting/ejs/smbcalls_rpc.c')
-rw-r--r--source4/scripting/ejs/smbcalls_rpc.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/source4/scripting/ejs/smbcalls_rpc.c b/source4/scripting/ejs/smbcalls_rpc.c
index 12b0d95e8e..8a5389fbab 100644
--- a/source4/scripting/ejs/smbcalls_rpc.c
+++ b/source4/scripting/ejs/smbcalls_rpc.c
@@ -105,6 +105,7 @@ done:
void *ptr;
struct rpc_request *req;
int callnum;
+ struct ejs_rpc *ejs;
if (argc != 2 ||
argv[0]->type != MPR_TYPE_OBJECT ||
@@ -132,15 +133,24 @@ done:
}
callnum = call - iface->calls;
+ ejs = talloc(mprMemCtx(), struct ejs_rpc);
+ if (ejs == NULL) {
+ status = NT_STATUS_NO_MEMORY;
+ goto done;
+ }
+
+ ejs->eid = eid;
+ ejs->callname = callname;
+
/* allocate the C structure */
- ptr = talloc_zero_size(mprMemCtx(), call->struct_size);
+ ptr = talloc_zero_size(ejs, call->struct_size);
if (ptr == NULL) {
status = NT_STATUS_NO_MEMORY;
goto done;
}
/* convert the mpr object into a C structure */
- status = ejs_pull_rpc(eid, callname, io, ptr, ejs_pull);
+ status = ejs_pull(ejs, io, ptr);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
@@ -154,7 +164,6 @@ done:
req = dcerpc_ndr_request_send(p, NULL, iface, callnum, ptr, ptr);
if (req == NULL) {
status = NT_STATUS_NO_MEMORY;
- talloc_free(ptr);
goto done;
}
status = dcerpc_ndr_request_recv(req);
@@ -164,10 +173,10 @@ done:
ndr_print_function_debug(call->ndr_print, call->name, NDR_OUT, ptr);
}
- status = ejs_push_rpc(eid, callname, io, ptr, ejs_push);
+ status = ejs_push(ejs, io, ptr);
- talloc_free(ptr);
done:
+ talloc_free(ejs);
ejsSetReturnValue(eid, mprNTSTATUS(status));
if (NT_STATUS_EQUAL(status, NT_STATUS_INTERNAL_ERROR)) {
return -1;