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

Fix off-by-one error

parent ea0debf8
No related branches found
No related tags found
No related merge requests found
...@@ -139,7 +139,7 @@ static struct channel *channel_get(struct list *list, int index) ...@@ -139,7 +139,7 @@ static struct channel *channel_get(struct list *list, int index)
static int channel_set(struct list *list, int index, struct channel channel) static int channel_set(struct list *list, int index, struct channel channel)
{ {
if (list->capacity < index) { if (list->capacity <= index) {
int capacity = index + 1; int capacity = index + 1;
void *new = realloc(list->channel, capacity * sizeof(*list->channel)); void *new = realloc(list->channel, capacity * sizeof(*list->channel));
if (new) { if (new) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment