git: 9front

Download patch

ref: c06e40ead4216e7f41b0bfab9733f4d49e215f9a
parent: b58cc186dcd38aed12efa03c61a36735025f4b0c
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Wed Feb 15 03:50:03 EST 2017

jukefs: fix realloc sizes (thanks mischief)

--- a/sys/src/games/music/jukefs/parse.c
+++ b/sys/src/games/music/jukefs/parse.c
@@ -436,7 +436,7 @@
 		 */
 		for(i = 0; i < parent->nchildren; i++)
 				if(parent->children[i] == child) return;
-		parent->children = realloc(parent->children, (i+1)*4);
+		parent->children = realloc(parent->children, (i+1)*sizeof(Object*));
 		parent->children[i] = child;
 		parent->nchildren++;
 		if(parent->type == Category && child->type == Category)
@@ -457,7 +457,7 @@
 		i = child->ncatparents;
 		if(0) fprint(2, "addcatparent %s parent %d type %d child %d type %d\n",where,
 			parent->tabno, parent->type, child->tabno, child->type);
-		child->catparents = realloc(child->catparents, (i+1)*4);
+		child->catparents = realloc(child->catparents, (i+1)*sizeof(Object*));
 		child->catparents[i] = parent;
 		child->ncatparents++;
 }
@@ -476,7 +476,7 @@
 //				if(child->catparents[i] == parent) return;
 		i = child->ncatparents;
 		fprint(2, "addcatparent parent %d child %d\n", parent->tabno, child->tabno);
-		child->catparents = realloc(child->catparents, (i+1)*4);
+		child->catparents = realloc(child->catparents, (i+1)*sizeof(Object*));
 		child->catparents[i] = parent;
 		child->ncatparents++;
 }
--