mirror of
https://github.com/samba-team/samba.git
synced 2025-01-26 10:04:02 +03:00
lib/param: remove duplicated copy service in lpcfg_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:
parent
c34a063a6d
commit
bbcd8d64dd
@ -557,18 +557,6 @@ bool lpcfg_parm_bool(struct loadparm_context *lp_ctx,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialise a service to the defaults.
|
||||
*/
|
||||
|
||||
static struct loadparm_service *init_service(TALLOC_CTX *mem_ctx, struct loadparm_service *sDefault)
|
||||
{
|
||||
struct loadparm_service *pservice =
|
||||
talloc_zero(mem_ctx, struct loadparm_service);
|
||||
copy_service(pservice, sDefault, NULL);
|
||||
return pservice;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a string value, deallocating any existing space, and allocing the space
|
||||
* for the string
|
||||
@ -621,7 +609,6 @@ struct loadparm_service *lpcfg_add_service(struct loadparm_context *lp_ctx,
|
||||
const char *name)
|
||||
{
|
||||
int i;
|
||||
struct loadparm_service tservice;
|
||||
int num_to_alloc = lp_ctx->iNumServices + 1;
|
||||
struct parmlist_entry *data, *pdata;
|
||||
|
||||
@ -629,8 +616,6 @@ struct loadparm_service *lpcfg_add_service(struct loadparm_context *lp_ctx,
|
||||
pservice = lp_ctx->sDefault;
|
||||
}
|
||||
|
||||
tservice = *pservice;
|
||||
|
||||
/* it might already exist */
|
||||
if (name) {
|
||||
struct loadparm_service *service = getservicebyname(lp_ctx,
|
||||
@ -671,12 +656,12 @@ struct loadparm_service *lpcfg_add_service(struct loadparm_context *lp_ctx,
|
||||
lp_ctx->iNumServices++;
|
||||
}
|
||||
|
||||
lp_ctx->services[i] = init_service(lp_ctx->services, lp_ctx->sDefault);
|
||||
lp_ctx->services[i] = talloc_zero(lp_ctx->services, struct loadparm_service);
|
||||
if (lp_ctx->services[i] == NULL) {
|
||||
DEBUG(0,("lpcfg_add_service: out of memory!\n"));
|
||||
return NULL;
|
||||
}
|
||||
copy_service(lp_ctx->services[i], &tservice, NULL);
|
||||
copy_service(lp_ctx->services[i], pservice, NULL);
|
||||
if (name != NULL)
|
||||
lpcfg_string_set(lp_ctx->services[i], &lp_ctx->services[i]->szService, name);
|
||||
return lp_ctx->services[i];
|
||||
|
Loading…
x
Reference in New Issue
Block a user