From d68b0b12b956b4b70953806e8cb4d9f6207057ed Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 11 Jan 2006 20:38:10 +0000 Subject: r12856: make the logic much more sane metze (This used to be commit ed4a3e53fd71679fbdfc2f2932c1098e03026285) --- source4/librpc/ndr/ndr.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'source4/librpc') diff --git a/source4/librpc/ndr/ndr.c b/source4/librpc/ndr/ndr.c index 9e307a3f38..a7f34ec002 100644 --- a/source4/librpc/ndr/ndr.c +++ b/source4/librpc/ndr/ndr.c @@ -272,16 +272,20 @@ char *ndr_print_function_string(TALLOC_CTX *mem_ctx, int flags, void *ptr) { struct ndr_print *ndr; - char *ret; + char *ret = NULL; ndr = talloc_zero(mem_ctx, struct ndr_print); if (!ndr) return NULL; - ndr->private = talloc_strdup(mem_ctx, ""); + ndr->private = talloc_strdup(ndr, ""); + if (!ndr->private) { + goto failed; + } ndr->print = ndr_print_string_helper; ndr->depth = 1; ndr->flags = 0; fn(ndr, name, flags, ptr); - ret = ndr->private; + ret = talloc_steal(mem_ctx, ndr->private); +failed: talloc_free(ndr); return ret; } -- cgit