--- a/ui/common/menu.c Tue Nov 26 10:40:03 2024 +0100 +++ b/ui/common/menu.c Tue Nov 26 15:53:57 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; }