shithub: riscv

Download patch

ref: 5d4a456ae6af550a39280b98554b42716a07f8ff
parent: 547f60b4c507778099635f5d2ec4919e1beb6a57
author: aiju <devnull@localhost>
date: Tue Mar 20 07:23:41 EDT 2018

libsat: setmalloctag, fix incorrect allocation size

--- a/sys/src/libsat/misc.c
+++ b/sys/src/libsat/misc.c
@@ -106,6 +106,7 @@
 	v = realloc(v, n);
 	if(v == nil)
 		saterror(s, "realloc: %r");
+	setmalloctag(v, getcallerpc(&s));
 	return v;
 }
 
--- a/sys/src/libsat/satsolve.c
+++ b/sys/src/libsat/satsolve.c
@@ -82,7 +82,7 @@
 {
 	satdebuginit(s);
 	satheapreset(s);
-	s->decbd = satrealloc(s, s->decbd, s->nvar * sizeof(int));
+	s->decbd = satrealloc(s, s->decbd, (s->nvar + 1) * sizeof(int));
 	s->decbd[0] = 0;
 	s->trail = satrealloc(s, s->trail, sizeof(int) * s->nvar);
 	s->fullrlits = satrealloc(s, s->fullrlits, sizeof(int) * s->nvar);