ui/common/menu.c

branch
newapi
changeset 393
3099bf907e21
parent 388
473c03f85197
child 404
384f6d1f5784
--- 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;
     }

mercurial