From 7ea3441a8c285adc0bf058cd2a0e22166d0cf042 Mon Sep 17 00:00:00 2001 From: Garming Sam Date: Tue, 18 Feb 2014 14:38:10 +1300 Subject: [PATCH] s3:param: remove the double initialization in add_a_service Signed-off-by: Garming Sam Reviewed-by: Andrew Bartlett Reviewed-by: Jeremy Allison --- source3/param/loadparm.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index 49fc21a2668..7ba68a68297 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -1539,12 +1539,9 @@ static void free_service_byindex(int idx) static int add_a_service(const struct loadparm_service *pservice, const char *name) { int i; - struct loadparm_service tservice; int num_to_alloc = iNumServices + 1; struct loadparm_service **tsp = NULL; - tservice = *pservice; - /* it might already exist */ if (name) { i = getservicebyname(name, NULL); @@ -1561,7 +1558,7 @@ static int add_a_service(const struct loadparm_service *pservice, const char *na return (-1); } ServicePtrs = tsp; - ServicePtrs[iNumServices] = talloc(NULL, struct loadparm_service); + ServicePtrs[iNumServices] = talloc_zero(NULL, struct loadparm_service); if (!ServicePtrs[iNumServices]) { DEBUG(0,("add_a_service: out of memory!\n")); return (-1); @@ -1570,8 +1567,7 @@ static int add_a_service(const struct loadparm_service *pservice, const char *na ServicePtrs[i]->valid = true; - init_service(ServicePtrs[i]); - copy_service(ServicePtrs[i], &tservice, NULL); + copy_service(ServicePtrs[i], pservice, NULL); if (name) string_set(ServicePtrs[i], &ServicePtrs[i]->szService, name); -- 2.11.4.GIT