summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/build/pidl/parser.pm12
-rw-r--r--source4/rpc_server/rpc_echo.c8
2 files changed, 9 insertions, 11 deletions
diff --git a/source4/build/pidl/parser.pm b/source4/build/pidl/parser.pm
index 88ba348486..d7f3814abd 100644
--- a/source4/build/pidl/parser.pm
+++ b/source4/build/pidl/parser.pm
@@ -318,14 +318,14 @@ sub ParseArrayPull($$$)
if ((util::need_alloc($e) && !util::is_fixed_array($e)) ||
($var_prefix eq "r->in." && util::has_property($e, "ref"))) {
if (!util::is_inline_array($e) || $ndr_flags eq "NDR_SCALARS") {
- pidl "\t\tNDR_ALLOC_N_SIZE(ndr, $var_prefix$e->{NAME}, MAX(1, $alloc_size), sizeof($var_prefix$e->{NAME}\[0]));\n";
+ pidl "\t\tNDR_ALLOC_N(ndr, $var_prefix$e->{NAME}, MAX(1, $alloc_size));\n";
}
}
if (($var_prefix eq "r->out." && util::has_property($e, "ref"))) {
if (!util::is_inline_array($e) || $ndr_flags eq "NDR_SCALARS") {
pidl "\tif (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {";
- pidl "\t\tNDR_ALLOC_N_SIZE(ndr, $var_prefix$e->{NAME}, MAX(1, $alloc_size), sizeof($var_prefix$e->{NAME}\[0]));\n";
+ pidl "\t\tNDR_ALLOC_N(ndr, $var_prefix$e->{NAME}, MAX(1, $alloc_size));\n";
pidl "\t}\n";
}
}
@@ -1259,7 +1259,13 @@ sub ParseFunctionPull($)
# we need to allocate any reference output variables, so that
# a dcerpc backend can be sure they are non-null
if (util::has_property($e, "out") && util::has_property($e, "ref")) {
- pidl "\tNDR_ALLOC(ndr, r->out.$e->{NAME});\n";
+ my $asize = util::array_size($e);
+ if (defined $asize) {
+ my $size = find_size_var($e, $asize, "r->out.");
+ pidl "\tNDR_ALLOC_N(ndr, r->out.$e->{NAME}, MAX(1, $size));\n";
+ } else {
+ pidl "\tNDR_ALLOC(ndr, r->out.$e->{NAME});\n";
+ }
}
}
diff --git a/source4/rpc_server/rpc_echo.c b/source4/rpc_server/rpc_echo.c
index 37b72f764b..d003f34ce4 100644
--- a/source4/rpc_server/rpc_echo.c
+++ b/source4/rpc_server/rpc_echo.c
@@ -31,10 +31,6 @@ static NTSTATUS echo_AddOne(struct dcesrv_state *dce, TALLOC_CTX *mem_ctx, struc
static NTSTATUS echo_EchoData(struct dcesrv_state *dce, TALLOC_CTX *mem_ctx, struct echo_EchoData *r)
{
- r->out.out_data = talloc(mem_ctx, r->in.len);
- if (!r->out.out_data) {
- return NT_STATUS_NO_MEMORY;
- }
memcpy(r->out.out_data, r->in.in_data, r->in.len);
return NT_STATUS_OK;
@@ -48,10 +44,6 @@ static NTSTATUS echo_SinkData(struct dcesrv_state *dce, TALLOC_CTX *mem_ctx, str
static NTSTATUS echo_SourceData(struct dcesrv_state *dce, TALLOC_CTX *mem_ctx, struct echo_SourceData *r)
{
int i;
- r->out.data = talloc(mem_ctx, r->in.len);
- if (!r->out.data) {
- return NT_STATUS_NO_MEMORY;
- }
for (i=0;i<r->in.len;i++) {
r->out.data[i] = i;
}