From: Douglas Bagnall Date: Wed, 29 Jul 2020 22:46:17 +0000 (+1200) Subject: ndr: maintain proper talloc tree in pull_string_array X-Git-Tag: talloc-2.3.2~980 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9bf331b46a70189f2f63a5223a31eae64a9854db;p=thirdparty%2Fsamba.git ndr: maintain proper talloc tree in pull_string_array We don't want to leave other parts of the ndr struct hanging off this string array just because LIBNDR_FLAG_REMAINING is used. Signed-off-by: Douglas Bagnall Reviewed-by: Noel Power Reviewed-by: Andrew Bartlett --- diff --git a/librpc/ndr/ndr_string.c b/librpc/ndr/ndr_string.c index 25f211b2ad3..4fd2006be20 100644 --- a/librpc/ndr/ndr_string.c +++ b/librpc/ndr/ndr_string.c @@ -380,12 +380,12 @@ _PUBLIC_ enum ndr_err_code ndr_pull_string_array(struct ndr_pull *ndr, int ndr_f tmp_ctx = ndr->current_mem_ctx; ndr->current_mem_ctx = a; NDR_CHECK(ndr_pull_string(ndr, ndr_flags, &s)); + ndr->current_mem_ctx = tmp_ctx; if ((ndr->data_size - ndr->offset) == 0 && ndr->flags & LIBNDR_FLAG_REMAINING) { a[count] = s; break; } - ndr->current_mem_ctx = tmp_ctx; if (strcmp("", s)==0) { a[count] = NULL; break;