diff options
author | metze <metze@0c0555d6-39d7-0310-84fc-f1cc0bd64818> | 2007-11-02 11:01:18 +0000 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-11-07 12:13:09 +0100 |
commit | e0c24fa2487fb1ea9852494a9e6160899c0c08e4 (patch) | |
tree | 34ebef88d2174dbd989b7b01925946995e554731 | |
parent | aef317ea57e71cbfb170bcd5c375047c6b117e03 (diff) | |
download | samba-e0c24fa2487fb1ea9852494a9e6160899c0c08e4.tar.gz samba-e0c24fa2487fb1ea9852494a9e6160899c0c08e4.tar.bz2 samba-e0c24fa2487fb1ea9852494a9e6160899c0c08e4.zip |
- check return value of ndr_push_set_switch_value()
- fix memory leaks in error pathes
metze
git-svn-id: svn+ssh://svn.samba.org/data/svn/samba/branches/SAMBA_4_0@25798 0c0555d6-39d7-0310-84fc-f1cc0bd64818
(This used to be commit a0d0a06a9e39ea4fd07e9381f4b3397f403ab79d)
-rw-r--r-- | source3/librpc/ndr/ndr.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source3/librpc/ndr/ndr.c b/source3/librpc/ndr/ndr.c index 8900e7a84f..1538891320 100644 --- a/source3/librpc/ndr/ndr.c +++ b/source3/librpc/ndr/ndr.c @@ -806,6 +806,7 @@ size_t ndr_size_struct(const void *p, int flags, ndr_push_flags_fn_t push) ndr->flags |= flags | LIBNDR_FLAG_NO_NDR_SIZE; status = push(ndr, NDR_SCALARS|NDR_BUFFERS, p); if (!NT_STATUS_IS_OK(status)) { + talloc_free(ndr); return 0; } ret = ndr->offset; @@ -828,9 +829,15 @@ size_t ndr_size_union(const void *p, int flags, uint32_t level, ndr_push_flags_f 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; |