diff options
author | Andrew Tridgell <tridge@samba.org> | 2009-09-12 15:21:33 +1000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2009-09-12 15:21:33 +1000 |
commit | 5c33042498763ce814c0539e0a96f73a06a76dfd (patch) | |
tree | 84ef084109154d12f9d804aea1a33f8be8e671e7 /librpc/ndr/libndr.h | |
parent | a8ab1e2570ac2a2e772295cd0cc46b7e60398043 (diff) | |
download | samba-5c33042498763ce814c0539e0a96f73a06a76dfd.tar.gz samba-5c33042498763ce814c0539e0a96f73a06a76dfd.tar.bz2 samba-5c33042498763ce814c0539e0a96f73a06a76dfd.zip |
s4-ndr: fixed memory leaks in ndr_pull_*_blob()
We needed to free the ndr structures, both on error and normal return
Diffstat (limited to 'librpc/ndr/libndr.h')
-rw-r--r-- | librpc/ndr/libndr.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/librpc/ndr/libndr.h b/librpc/ndr/libndr.h index 7b981f9171..d01b68ef51 100644 --- a/librpc/ndr/libndr.h +++ b/librpc/ndr/libndr.h @@ -254,6 +254,16 @@ enum ndr_compression_alg { } \ } while (0) +/* if the call fails then free the ndr pointer */ +#define NDR_CHECK_FREE(call) do { \ + enum ndr_err_code _status; \ + _status = call; \ + if (!NDR_ERR_CODE_IS_SUCCESS(_status)) { \ + talloc_free(ndr); \ + return _status; \ + } \ +} while (0) + #define NDR_PULL_GET_MEM_CTX(ndr) (ndr->current_mem_ctx) #define NDR_PULL_SET_MEM_CTX(ndr, mem_ctx, flgs) do {\ |