shithub: sl

Download patch

ref: 087b3dc2102091cb0a78c812abb7b45109ae13d8
parent: b0267b674082eadc432d3e159a800a874c04454d
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Tue Jan 21 00:45:20 EST 2025

assert after MEM_CALLOC

--- a/3rd/mp/test/ld.c
+++ b/3rd/mp/test/ld.c
@@ -13,7 +13,9 @@
 static void
 ldbits(ldint *a, int n)
 {
-	a->b = realloc(a->b, n);
+	void *b = realloc(a->b, n);
+	assert(b != nil);
+	a->b = b;
 	a->n = n;
 }
 
@@ -67,8 +69,10 @@
 	ldint *a;
 	
 	a = malloc(sizeof(ldint));
+	assert(a != nil);
 	if(n <= 0) n = 1;
 	a->b = malloc(n);
+	assert(a->b != nil);
 	a->n = n;
 	return a;
 }
--- a/cvalues.c
+++ b/cvalues.c
@@ -849,6 +849,7 @@
 {
 	cvalue_t *cv;
 	cv = MEM_CALLOC(CVALUE_NWORDS, sizeof(*cv));
+	assert(cv != nil);
 	cv->type = FL(builtintype);
 	cv->data = &cv->_space[0];
 	cv->len = sizeof(value_t);
--- a/types.c
+++ b/types.c
@@ -68,6 +68,7 @@
 define_opaque_type(value_t sym, size_t sz, cvtable_t *vtab, cvinitfunc_t init)
 {
 	fltype_t *ft = MEM_CALLOC(1, sizeof(fltype_t));
+	assert(ft != nil);
 	ft->type = sym;
 	ft->numtype = NONNUMERIC;
 	ft->size = sz;