summaryrefslogtreecommitdiff
path: root/source4/librpc
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-11-02 11:01:18 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:44:03 +0100
commit602461bfa60db593f7a2f6876ebbef5c880b1f04 (patch)
treeae3d866e7e1896763c504d70888471ac0807672f /source4/librpc
parent131fc3a192cd4a23cbc01a0e0abb5033ca5aa049 (diff)
downloadsamba-602461bfa60db593f7a2f6876ebbef5c880b1f04.tar.gz
samba-602461bfa60db593f7a2f6876ebbef5c880b1f04.tar.bz2
samba-602461bfa60db593f7a2f6876ebbef5c880b1f04.zip
r25798: - check return value of ndr_push_set_switch_value()
- fix memory leaks in error pathes metze (This used to be commit 667e83fd78293942c61d141dfe0d90e662768380)
Diffstat (limited to 'source4/librpc')
-rw-r--r--source4/librpc/ndr/ndr.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c
index 71d1e6c8e9..6fc6409cb2 100644
--- a/source4/librpc/ndr/ndr.c
+++ b/source4/librpc/ndr/ndr.c
@@ -843,6 +843,7 @@ _PUBLIC_ size_t ndr_size_struct(const void *p, int flags, ndr_push_flags_fn_t pu
ndr->flags |= flags | LIBNDR_FLAG_NO_NDR_SIZE;
status = push(ndr, NDR_SCALARS|NDR_BUFFERS, discard_const(p));
if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(ndr);
return 0;
}
ret = ndr->offset;
@@ -865,9 +866,15 @@ _PUBLIC_ size_t ndr_size_union(const void *p, int flags, uint32_t level, ndr_pus
ndr = ndr_push_init_ctx(NULL);
if (!ndr) return 0;
ndr->flags |= flags | LIBNDR_FLAG_NO_NDR_SIZE;
- ndr_push_set_switch_value(ndr, p, level);
+
+ status = ndr_push_set_switch_value(ndr, p, level);
+ if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(ndr);
+ return 0;
+ }
status = push(ndr, NDR_SCALARS|NDR_BUFFERS, p);
if (!NT_STATUS_IS_OK(status)) {
+ talloc_free(ndr);
return 0;
}
ret = ndr->offset;