svn commit: samba r23748 - in branches: SAMBA_3_0/source/utils
SAMBA_3_0_26/source/utils
obnox at samba.org
obnox at samba.org
Sat Jul 7 22:29:34 GMT 2007
Author: obnox
Date: 2007-07-07 22:29:34 +0000 (Sat, 07 Jul 2007)
New Revision: 23748
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=23748
Log:
Clean use of talloc in import_process_service:
create a temporary talloc ctx for the function.
Michael
Modified:
branches/SAMBA_3_0/source/utils/net_conf.c
branches/SAMBA_3_0_26/source/utils/net_conf.c
Changeset:
Modified: branches/SAMBA_3_0/source/utils/net_conf.c
===================================================================
--- branches/SAMBA_3_0/source/utils/net_conf.c 2007-07-07 22:18:54 UTC (rev 23747)
+++ branches/SAMBA_3_0/source/utils/net_conf.c 2007-07-07 22:29:34 UTC (rev 23748)
@@ -536,7 +536,14 @@
struct registry_key *key;
WERROR werr;
char *valstr = NULL;
+ TALLOC_CTX *tmp_ctx = NULL;
+ tmp_ctx = talloc_new(ctx);
+ if (tmp_ctx == NULL) {
+ werr = WERR_NOMEM;
+ goto done;
+ }
+
servicename = (share->service == GLOBAL_SECTION_SNUM)?
GLOBAL_NAME : lp_servicename(share->service);
@@ -544,13 +551,13 @@
d_printf("[%s]\n", servicename);
}
else {
- if (smbconf_key_exists(ctx, servicename)) {
- werr = reg_delkey_internal(ctx, servicename);
+ if (smbconf_key_exists(tmp_ctx, servicename)) {
+ werr = reg_delkey_internal(tmp_ctx, servicename);
if (!W_ERROR_IS_OK(werr)) {
goto done;
}
}
- werr = reg_createkey_internal(ctx, servicename, &key);
+ werr = reg_createkey_internal(tmp_ctx, servicename, &key);
if (!W_ERROR_IS_OK(werr)) {
goto done;
}
@@ -562,7 +569,7 @@
&& !(parm->flags & FLAG_GLOBAL))
continue;
- valstr = parm_valstr(ctx, parm, share);
+ valstr = parm_valstr(tmp_ctx, parm, share);
if (parm->type != P_SEP) {
if (opt_testmode) {
@@ -583,7 +590,9 @@
}
ret = 0;
+
done:
+ TALLOC_FREE(tmp_ctx);
return ret;
}
Modified: branches/SAMBA_3_0_26/source/utils/net_conf.c
===================================================================
--- branches/SAMBA_3_0_26/source/utils/net_conf.c 2007-07-07 22:18:54 UTC (rev 23747)
+++ branches/SAMBA_3_0_26/source/utils/net_conf.c 2007-07-07 22:29:34 UTC (rev 23748)
@@ -536,7 +536,14 @@
struct registry_key *key;
WERROR werr;
char *valstr = NULL;
+ TALLOC_CTX *tmp_ctx = NULL;
+ tmp_ctx = talloc_new(ctx);
+ if (tmp_ctx == NULL) {
+ werr = WERR_NOMEM;
+ goto done;
+ }
+
servicename = (share->service == GLOBAL_SECTION_SNUM)?
GLOBAL_NAME : lp_servicename(share->service);
@@ -544,13 +551,13 @@
d_printf("[%s]\n", servicename);
}
else {
- if (smbconf_key_exists(ctx, servicename)) {
- werr = reg_delkey_internal(ctx, servicename);
+ if (smbconf_key_exists(tmp_ctx, servicename)) {
+ werr = reg_delkey_internal(tmp_ctx, servicename);
if (!W_ERROR_IS_OK(werr)) {
goto done;
}
}
- werr = reg_createkey_internal(ctx, servicename, &key);
+ werr = reg_createkey_internal(tmp_ctx, servicename, &key);
if (!W_ERROR_IS_OK(werr)) {
goto done;
}
@@ -562,7 +569,7 @@
&& !(parm->flags & FLAG_GLOBAL))
continue;
- valstr = parm_valstr(ctx, parm, share);
+ valstr = parm_valstr(tmp_ctx, parm, share);
if (parm->type != P_SEP) {
if (opt_testmode) {
@@ -583,7 +590,9 @@
}
ret = 0;
+
done:
+ TALLOC_FREE(tmp_ctx);
return ret;
}
More information about the samba-cvs
mailing list