diff options
author | Simo Sorce <idra@samba.org> | 2001-08-10 09:52:10 +0000 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2001-08-10 09:52:10 +0000 |
commit | fd54412ce9c3504a547e232602d6129e08dd9d4d (patch) | |
tree | 055955b2fe0158fc8e2e148bdc1d2f40aad518ee /source/param/loadparm.c | |
parent | e98f9481235dce9a0a76450b84769b86eca57ca2 (diff) | |
download | samba-fd54412ce9c3504a547e232602d6129e08dd9d4d.tar.gz samba-fd54412ce9c3504a547e232602d6129e08dd9d4d.tar.xz samba-fd54412ce9c3504a547e232602d6129e08dd9d4d.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
Diffstat (limited to 'source/param/loadparm.c')
-rw-r--r-- | source/param/loadparm.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/source/param/loadparm.c b/source/param/loadparm.c index c110139e211..cb7f9f35c39 100644 --- a/source/param/loadparm.c +++ b/source/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); |