summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGarming Sam <garming@catalyst.net.nz>2014-02-18 14:38:10 +1300
committerJeremy Allison <jra@samba.org>2014-05-07 19:49:15 +0200
commit7ea3441a8c285adc0bf058cd2a0e22166d0cf042 (patch)
treeec0a897fc700934c00c86db4fc78aacbc53e141f
parentab1030a9a20325294840c0a7721fae72ca7d7613 (diff)
downloadsamba-7ea3441a8c285adc0bf058cd2a0e22166d0cf042.tar.gz
samba-7ea3441a8c285adc0bf058cd2a0e22166d0cf042.tar.xz
samba-7ea3441a8c285adc0bf058cd2a0e22166d0cf042.zip
s3:param: remove the double initialization in add_a_service
Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r--source3/param/loadparm.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 49fc21a266..7ba68a6829 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);