mirror of
https://github.com/samba-team/samba.git
synced 2025-01-03 01:18:10 +03:00
libcli: Simplify pull_integer()
Use ndr_pull_struct_blob_noalloc, we don't need talloc here. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Pavel Filipenský <pfilipensky@samba.org>
This commit is contained in:
parent
8f1d903524
commit
dddbab8e36
@ -114,21 +114,19 @@ static ssize_t pull_integer(TALLOC_CTX *mem_ctx,
|
||||
uint8_t *data, size_t length,
|
||||
struct ace_condition_int *tok)
|
||||
{
|
||||
ssize_t bytes_used;
|
||||
size_t consumed;
|
||||
enum ndr_err_code ndr_err;
|
||||
DATA_BLOB v = data_blob_const(data, length);
|
||||
struct ndr_pull *ndr = ndr_pull_init_blob(&v, mem_ctx);
|
||||
if (ndr == NULL) {
|
||||
return -1;
|
||||
}
|
||||
ndr_err = ndr_pull_ace_condition_int(ndr, NDR_SCALARS|NDR_BUFFERS, tok);
|
||||
|
||||
ndr_err = ndr_pull_struct_blob_noalloc(
|
||||
data,
|
||||
length,
|
||||
tok,
|
||||
(ndr_pull_flags_fn_t)ndr_pull_ace_condition_int,
|
||||
&consumed);
|
||||
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
|
||||
TALLOC_FREE(ndr);
|
||||
return -1;
|
||||
}
|
||||
bytes_used = ndr->offset;
|
||||
TALLOC_FREE(ndr);
|
||||
return bytes_used;
|
||||
return consumed;
|
||||
}
|
||||
|
||||
static ssize_t push_integer(uint8_t *data, size_t available,
|
||||
|
Loading…
Reference in New Issue
Block a user