This fixes a bug that can cause a crash when accessing memory that was
already free()'ed again, because the variable that contains the amount
of allocated memory is not updated when memory allocation changes.
The bug is fixed by updating that variable when memory is allocated.
right_gadget_border =
checked_calloc(num_editor_gadgets * sizeof(int));
- editor_el_empty = checked_calloc(ED_NUM_ELEMENTLIST_BUTTONS * sizeof(int));
+ // set number of empty (padding) element buttons to maximum number of buttons
+ num_editor_el_empty = ED_NUM_ELEMENTLIST_BUTTONS;
+
+ editor_el_empty = checked_calloc(num_editor_el_empty * sizeof(int));
editor_el_empty_ptr = editor_el_empty;
use_permanent_palette = !editor.palette.show_as_separate_screen;