com_index_to_delete[i] holds the location in lcom->val of where the
value is stored, we cannot just increment it by this value on each
iteration as we'll overflow the size of lcom->val.
Signed-off-by: Nigel Kukard <nkukard@lbsd.net>
}
/* Delete all of the communities we flagged for deletion */
- ptr = lcom->val;
for (i = delete_index - 1; i >= 0; i--) {
- ptr += (com_index_to_delete[i] * LCOMMUNITY_SIZE);
+ ptr = lcom->val + (com_index_to_delete[i] * LCOMMUNITY_SIZE);
lcommunity_del_val(lcom, ptr);
}