]> git.mdlowis.com Git - proto/anvil.git/commitdiff
fixed bad realloc calls in mons_layer()
authorMichael D. Lowis <mike.lowis@gentex.com>
Wed, 18 Mar 2020 17:21:16 +0000 (13:21 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Wed, 18 Mar 2020 17:21:16 +0000 (13:21 -0400)
mons.c

diff --git a/mons.c b/mons.c
index 41bae5818644bf9a6b6536a7dbb3807c174fbe93..b192100a3e133c5d2974f37d0d77f35c06235cfb 100644 (file)
--- a/mons.c
+++ b/mons.c
@@ -46,7 +46,7 @@ void mons_layer(Monitor* mon)
     Window* wins = NULL;
     for (Client* c = mon->cspace->floating; c; c = c->next)
     {
-        wins = realloc(wins, ++nwins);
+        wins = realloc(wins, ++nwins * sizeof(Window));
         wins[nwins-1] = c->frame;
     }
     /* now lower all of the tiled windows */
@@ -54,7 +54,7 @@ void mons_layer(Monitor* mon)
     {
         for (Client* c = col->clients; c; c = c->next)
         {
-            wins = realloc(wins, ++nwins);
+            wins = realloc(wins, ++nwins * sizeof(Window));
             wins[nwins-1] = c->frame;
         }
     }