summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/array.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/common/array.c b/src/common/array.c
index 8264101..3f721be 100644
--- a/src/common/array.c
+++ b/src/common/array.c
@@ -285,7 +285,7 @@ void copy_flat_array_items(flat_array_t **src, flat_array_t **dest, size_t size,
{
extended = EXTENDED_ARRAY(*src);
- new_ext = (ext_flat_array_t *)malloc(sizeof(ext_flat_array_t));
+ new_ext = malloc(sizeof(ext_flat_array_t));
new_ext->items = malloc(extended->count * size);
new_ext->count = extended->count;
@@ -387,7 +387,7 @@ void add_item_to_flat_array(flat_array_t **array, const void *item, size_t size)
{
if (FLAT_ARRAY_HAS_NO_INDEX(*array))
{
- extended = (ext_flat_array_t *)malloc(sizeof(ext_flat_array_t));
+ extended = malloc(sizeof(ext_flat_array_t));
extended->items = malloc(2 * size);
extended->count = 2;
@@ -456,7 +456,7 @@ void insert_item_into_flat_array(flat_array_t **array, void *item, size_t size,
{
if (FLAT_ARRAY_HAS_NO_INDEX(*array))
{
- extended = (ext_flat_array_t *)malloc(sizeof(ext_flat_array_t));
+ extended = malloc(sizeof(ext_flat_array_t));
extended->items = malloc(size);
extended->count = 1;
@@ -581,6 +581,7 @@ void rem_item_from_flat_array(flat_array_t **array, size_t index, size_t size)
else
memcpy(new, ((char *)extended->items) + size, size);
+ free(extended->items);
free(extended);
relock_flat_array(array, new);