diff options
| author | Alexandra Ellwood <lxs@mit.edu> | 2008-03-18 19:25:16 +0000 |
|---|---|---|
| committer | Alexandra Ellwood <lxs@mit.edu> | 2008-03-18 19:25:16 +0000 |
| commit | f8d4e9aaad429fd6fac6504a527ab0258f47b854 (patch) | |
| tree | 113cf627b1a1cbffd54f632670a8b06768012ca4 /src/ccapi/common/cci_array_internal.c | |
| parent | d8d990c823f7ba6070622acf5ff2d08af7c1d7a9 (diff) | |
| download | krb5-f8d4e9aaad429fd6fac6504a527ab0258f47b854.tar.gz krb5-f8d4e9aaad429fd6fac6504a527ab0258f47b854.tar.xz krb5-f8d4e9aaad429fd6fac6504a527ab0258f47b854.zip | |
CCacheServer should track client iterators
The CCacheServer needs to track client iterators so that if
a client crashes while iterating the resources on the server
for that iterator are freed.
ticket: new
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20279 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/ccapi/common/cci_array_internal.c')
| -rw-r--r-- | src/ccapi/common/cci_array_internal.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/ccapi/common/cci_array_internal.c b/src/ccapi/common/cci_array_internal.c index bdd939dbc..b5a0f693b 100644 --- a/src/ccapi/common/cci_array_internal.c +++ b/src/ccapi/common/cci_array_internal.c @@ -52,7 +52,6 @@ static cc_int32 cci_array_resize (cci_array_t io_array, { cc_int32 err = ccNoError; cc_uint64 new_max_count = 0; - cci_array_object_t *objects = NULL; if (!io_array) { err = cci_check_error (ccErrBadParam); } @@ -75,8 +74,8 @@ static cc_int32 cci_array_resize (cci_array_t io_array, } } - if (!err) { - objects = io_array->objects; + if (!err && io_array->max_count != new_max_count) { + cci_array_object_t *objects = io_array->objects; if (!objects) { objects = malloc (new_max_count * sizeof (*objects)); @@ -84,11 +83,11 @@ static cc_int32 cci_array_resize (cci_array_t io_array, objects = realloc (objects, new_max_count * sizeof (*objects)); } if (!objects) { err = cci_check_error (ccErrNoMem); } - } - - if (!err) { - io_array->objects = objects; - io_array->max_count = new_max_count; + + if (!err) { + io_array->objects = objects; + io_array->max_count = new_max_count; + } } return cci_check_error (err); @@ -236,12 +235,12 @@ cc_int32 cci_array_remove (cci_array_t io_array, memmove (&io_array->objects[in_position], &io_array->objects[in_position + 1], move_count * sizeof (*io_array->objects)); } + io_array->count--; if (io_array->object_release) { io_array->object_release (object); } - io_array->count--; cci_array_resize (io_array, io_array->count); - } + } return cci_check_error (err); } |
