Skip to content

Commit

Permalink
Fix inserting new meta element
Browse files Browse the repository at this point in the history
Fixes #8
  • Loading branch information
michael-dev committed Aug 26, 2024
1 parent 6f3a489 commit 0408faf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/vlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ vlan_find_or_add_room(struct vlan_arr *arr, uint16_t vid)
arr->nummeta++;
arr->meta = realloc(arr->meta, arr->nummeta * sizeof(*arr->meta));
assert(arr->meta);
for (uint16_t i = succ; i < arr->nummeta - 1; i++)
arr->meta[i+1] = arr->meta[i];
for (uint16_t i = arr->nummeta - 1; i > succ; i--)
arr->meta[i] = arr->meta[i - 1];
arr->meta[succ].offset = startoffset;
arr->meta[succ].start = vid / 16;
return succ;
Expand Down

0 comments on commit 0408faf

Please sign in to comment.