diff options
author | Nalin Dahyabhai <nalin.dahyabhai@pobox.com> | 2008-07-30 18:38:29 -0400 |
---|---|---|
committer | Nalin Dahyabhai <nalin.dahyabhai@pobox.com> | 2008-07-30 18:38:29 -0400 |
commit | 58bfa94d81062fe08d1ff1fc14b4fcd4ee3d7080 (patch) | |
tree | 0e2872e2438b341d81ab872f0cd425a04b4dfbc3 /src | |
parent | 3a2d76abecff6e8537e41f20273742ec13e30c1d (diff) | |
download | slapi-nis-58bfa94d81062fe08d1ff1fc14b4fcd4ee3d7080.tar.gz slapi-nis-58bfa94d81062fe08d1ff1fc14b4fcd4ee3d7080.tar.xz slapi-nis-58bfa94d81062fe08d1ff1fc14b4fcd4ee3d7080.zip |
backend_free_gathered_data()
- double-check that arrays aren't NULL before
indexing then
backend_gather_data()
- in the event of a parsing error, actually return zero
as the length of the arrays we'd be populating
- correctly NULL terminate the list of results we hand back
Diffstat (limited to 'src')
-rw-r--r-- | src/back-nis.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/back-nis.c b/src/back-nis.c index 07fe0cd..915b5cf 100644 --- a/src/back-nis.c +++ b/src/back-nis.c @@ -157,15 +157,19 @@ backend_free_gathered_data(char **all, unsigned int *all_lengths, unsigned int i; free(all); free(all_lengths); - for (i = 0; i < n_singles; i++) { - format_free_data(singles[i]); + if (singles != NULL) { + for (i = 0; i < n_singles; i++) { + format_free_data(singles[i]); + } } free(singles); - for (i = 0; i < n_groups; i++) { - format_free_data_set(groups[i], group_lengths[i]); + if (groups != NULL) { + for (i = 0; i < n_groups; i++) { + format_free_data_set(groups[i], group_lengths[i]); + } } - free(group_lengths); free(groups); + free(group_lengths); } static char ** backend_gather_data(struct plugin_state *state, Slapi_Entry *e, @@ -244,7 +248,10 @@ backend_gather_data(struct plugin_state *state, Slapi_Entry *e, free(groups); free(group_lengths); *ret_singles = NULL; + *ret_n_singles = 0; *ret_groups = NULL; + *ret_group_lengths = NULL; + *ret_n_groups = 0; *ret_lengths = NULL; return NULL; } @@ -286,6 +293,7 @@ backend_gather_data(struct plugin_state *state, Slapi_Entry *e, } } } + ret[k] = NULL; *ret_lengths = lengths; *ret_n_singles = n_singles; *ret_singles = singles; |