+ if (list->capacity <= list->length)
+ {
+ // Does a non-FP calcuation of the 1.5 growth factor. Helpful for
+ // certain limited platforms.
+ size_t new_capacity = ((list->capacity * 3) + 1) / 2;
+
+ // In case the re-alloc returns null, use a local variable to avoid
+ // losing the current block of memory.
+ void *tmp = OICRealloc(list->data,
+ new_capacity * sizeof(list->data[0]));
+ if (!tmp)
+ {
+ OIC_LOG(DEBUG, TAG, "Memory reallocation failed.");
+ return false;
+ }
+ list->data = (void **) tmp;
+ memset(list->data + list->capacity, 0,
+ (new_capacity - list->capacity) * sizeof(list->data[0]));
+ list->capacity = (uint32_t)new_capacity;