Skip to content
Snippets Groups Projects
Commit 42c50f16 authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Allocate channel values of correct size (a pointer)

parent 6f606cdc
No related branches found
No related tags found
No related merge requests found
......@@ -46,12 +46,12 @@ static int channel_list_set(struct channel_list *list,
if (list->capacity <= index) {
int capacity;
for (capacity = 2 ; capacity <= index ; capacity *= 2);
void *new = realloc(list->value, capacity * sizeof(**list->value));
void *new = realloc(list->value, capacity * sizeof(*list->value));
if (!new) {
goto err;
}
void *p = new + list->capacity * sizeof(*list->value);
memset(p, 0, (capacity - list->capacity) * sizeof(**list->value));
memset(p, 0, (capacity - list->capacity) * sizeof(*list->value));
list->value = new;
list->capacity = capacity;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment