--- a/ui/common/menu.c Tue Nov 26 11:38:10 2024 +0100 +++ b/ui/common/menu.c Wed Nov 27 13:27:30 2024 +0100 @@ -82,8 +82,9 @@ for (n = 0; groups[n] > -1; n++) { } if (ngroups > 0) { - int* newarray = calloc(n, sizeof(int)); + int* newarray = calloc(n+1, sizeof(int)); memcpy(newarray, groups, n * sizeof(int)); + newarray[n] = -1; *ngroups = n; return newarray; }