summaryrefslogtreecommitdiff
path: root/source3/param/loadparm.c
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2001-08-10 09:52:10 +0000
committerSimo Sorce <idra@samba.org>2001-08-10 09:52:10 +0000
commitacc149c427e780b35ebe3028722ed0c42c4c3854 (patch)
tree064b2307dac4fbaa23c1fdab0d900b63faf04737 /source3/param/loadparm.c
parent5c47841335059ace57dfbf03e35872504d86b447 (diff)
downloadsamba-acc149c427e780b35ebe3028722ed0c42c4c3854.tar.gz
samba-acc149c427e780b35ebe3028722ed0c42c4c3854.tar.bz2
samba-acc149c427e780b35ebe3028722ed0c42c4c3854.zip
- avoid possible mem leaks in rpcclient/cmd_*.c (talloc_destroy not performed)
- ported two rpc back from TNG (WINREG: shutdown and abort shutdown) - some optimizations and changed some DEBUG statement in loadparm.c - changed rpcclient a bit moved from non reentrant next_token_nr to next_token - in cmd_reg.c not sure if getopt will work ok on all platforms only setting optind=0 (This used to be commit fd54412ce9c3504a547e232602d6129e08dd9d4d)
Diffstat (limited to 'source3/param/loadparm.c')
-rw-r--r--source3/param/loadparm.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index c110139e21..cb7f9f35c3 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -3580,8 +3580,8 @@ char **lp_list_make(char *string)
if (!string || !*string) return NULL;
s = strdup(string);
- if (!s || !*s) {
- DEBUG(0,("ERROR: Unable to allocate memory"));
+ if (!s) {
+ DEBUG(0,("lp_list_make: Unable to allocate memory"));
return NULL;
}
@@ -3589,15 +3589,13 @@ char **lp_list_make(char *string)
list = NULL;
str = s;
- while (*str)
- {
- if (!next_token(&str, tok, LIST_SEP, sizeof(pstring))) continue;
-
+ while (next_token(&str, tok, LIST_SEP, sizeof(pstring)))
+ {
if (num == lsize) {
lsize += P_LIST_ABS;
rlist = (char **)Realloc(list, ((sizeof(char **)) * (lsize +1)));
if (!rlist) {
- DEBUG(0,("ERROR: Unable to allocate memory"));
+ DEBUG(0,("lp_list_make: Unable to allocate memory"));
lp_list_free (&list);
free (s);
return NULL;
@@ -3608,7 +3606,7 @@ char **lp_list_make(char *string)
list[num] = strdup(tok);
if (!list[num]) {
- DEBUG(0,("ERROR: Unable to allocate memory"));
+ DEBUG(0,("lp_list_make: Unable to allocate memory"));
lp_list_free (&list);
free (s);
return NULL;
@@ -3638,7 +3636,7 @@ BOOL lp_list_copy(char ***dest, char **src)
lsize += P_LIST_ABS;
rlist = (char **)Realloc(list, ((sizeof(char **)) * (lsize +1)));
if (!rlist) {
- DEBUG(0,("ERROR: Unable to allocate memory"));
+ DEBUG(0,("lp_list_copy: Unable to allocate memory"));
lp_list_free (&list);
return False;
}
@@ -3648,7 +3646,7 @@ BOOL lp_list_copy(char ***dest, char **src)
list[num] = strdup(src[num]);
if (!list[num]) {
- DEBUG(0,("ERROR: Unable to allocate memory"));
+ DEBUG(0,("lp_list_copy: Unable to allocate memory"));
lp_list_free (&list);
return False;
}
@@ -3713,7 +3711,7 @@ BOOL lp_list_substitute(char **list, const char *pattern, const char *insert)
{
t = (char *) malloc(ls +ld +1);
if (!t) {
- DEBUG(0,("ERROR: Unable to allocate memory"));
+ DEBUG(0,("lp_list_substitute: Unable to allocate memory"));
return False;
}
memcpy(t, *list, d);