1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-03 04:22:09 +03:00

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>
This commit is contained in:
Garming Sam
2014-02-18 14:38:10 +13:00
committed by Jeremy Allison
parent ab1030a9a2
commit 7ea3441a8c

View File

@ -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);