diff options
author | Tim Potter <tpot@samba.org> | 2002-01-11 03:49:51 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2002-01-11 03:49:51 +0000 |
commit | 9ee8213f9a6fbcfc5a52cde36bb2b3bb146f8239 (patch) | |
tree | 97e93b3435920e56bc8fbd2a66910c2d6535e921 /source3/nsswitch | |
parent | 3469866334d06d089cc334e0d610577a001e33de (diff) | |
download | samba-9ee8213f9a6fbcfc5a52cde36bb2b3bb146f8239.tar.gz samba-9ee8213f9a6fbcfc5a52cde36bb2b3bb146f8239.tar.bz2 samba-9ee8213f9a6fbcfc5a52cde36bb2b3bb146f8239.zip |
Some memory leak fixes.
(This used to be commit da4db0373b65d975d5129715d6b1fa725b188766)
Diffstat (limited to 'source3/nsswitch')
-rw-r--r-- | source3/nsswitch/wbinfo.c | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/source3/nsswitch/wbinfo.c b/source3/nsswitch/wbinfo.c index 08b444a7c8..ab5d98bf9e 100644 --- a/source3/nsswitch/wbinfo.c +++ b/source3/nsswitch/wbinfo.c @@ -93,13 +93,13 @@ static BOOL wbinfo_get_usergroups(char *user) result = winbindd_request(WINBINDD_GETGROUPS, &request, &response); - if (result != NSS_STATUS_SUCCESS) { + if (result != NSS_STATUS_SUCCESS) return False; - } - for (i = 0; i < response.data.num_entries; i++) { + for (i = 0; i < response.data.num_entries; i++) printf("%d\n", (int)((gid_t *)response.extra_data)[i]); - } + + SAFE_FREE(response.extra_data); return True; } @@ -123,10 +123,12 @@ static BOOL wbinfo_list_domains(void) /* Display response */ if (response.extra_data) { - while(next_token((char **)&response.extra_data, name, ",", - sizeof(fstring))) { + char *extra_data = (char *)response.extra_data; + + while(next_token(&extra_data, name, ",", sizeof(fstring))) printf("%s\n", name); - } + + SAFE_FREE(response.extra_data); } return True; @@ -413,6 +415,7 @@ static BOOL wbinfo_auth_crap(char *username) static BOOL print_domain_users(void) { struct winbindd_response response; + char *extra_data; fstring name; /* Send request to winbind daemon */ @@ -426,15 +429,16 @@ static BOOL print_domain_users(void) /* Look through extra data */ - if (!response.extra_data) { + if (!response.extra_data) return False; - } - while(next_token((char **)&response.extra_data, name, ",", - sizeof(fstring))) { + extra_data = (char *)response.extra_data; + + while(next_token(&extra_data, name, ",", sizeof(fstring))) printf("%s\n", name); - } + SAFE_FREE(response.extra_data); + return True; } @@ -443,6 +447,7 @@ static BOOL print_domain_users(void) static BOOL print_domain_groups(void) { struct winbindd_response response; + char *extra_data; fstring name; ZERO_STRUCT(response); @@ -454,14 +459,15 @@ static BOOL print_domain_groups(void) /* Look through extra data */ - if (!response.extra_data) { + if (!response.extra_data) return False; - } - while(next_token((char **)&response.extra_data, name, ",", - sizeof(fstring))) { + extra_data = (char *)response.extra_data; + + while(next_token(&extra_data, name, ",", sizeof(fstring))) printf("%s\n", name); - } + + SAFE_FREE(response.extra_data); return True; } |