From 8c466c14114f6f9fc1b731184067cbd134445ae5 Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Fri, 26 Aug 2011 12:59:01 +1000 Subject: [PATCH] s3-param: Allocate talloc stackframe before calling s3 param routines Signed-off-by: Andrew Bartlett --- source3/param/loadparm_ctx.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/source3/param/loadparm_ctx.c b/source3/param/loadparm_ctx.c index 5cf8ce67cd1..3d3ff179fc6 100644 --- a/source3/param/loadparm_ctx.c +++ b/source3/param/loadparm_ctx.c @@ -20,6 +20,30 @@ #include "includes.h" #include "../source4/param/s3_param.h" +static struct loadparm_service *lp_service_for_s4_ctx(const char *servicename) +{ + TALLOC_CTX *mem_ctx; + struct loadparm_service *service; + + mem_ctx = talloc_stackframe(); + service = lp_service(servicename); + talloc_free(mem_ctx); + + return service; +} + +static struct loadparm_service *lp_servicebynum_for_s4_ctx(int servicenum) +{ + TALLOC_CTX *mem_ctx; + struct loadparm_service *service; + + mem_ctx = talloc_stackframe(); + service = lp_servicebynum(servicenum); + talloc_free(mem_ctx); + + return service; +} + static bool lp_load_for_s4_ctx(const char *filename) { TALLOC_CTX *mem_ctx; @@ -41,8 +65,8 @@ static const struct loadparm_s3_context s3_fns = .get_parametric = lp_parm_const_string_service, .get_parm_struct = lp_get_parameter, .get_parm_ptr = lp_parm_ptr, - .get_service = lp_service, - .get_servicebynum = lp_servicebynum, + .get_service = lp_service_for_s4_ctx, + .get_servicebynum = lp_servicebynum_for_s4_ctx, .get_default_loadparm_service = lp_default_loadparm_service, .get_numservices = lp_numservices, .load = lp_load_for_s4_ctx, -- 2.11.4.GIT