ui/common/menu.c

changeset 90
f501f0efc9a8
parent 88
e27526429d85
child 100
d2bd73d28ff1
--- 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;
     }

mercurial