shithub: riscv

Download patch

ref: f1254da64de2c728a59380644c23e9ce1a4f4351
parent: 78808ca314949f40d9f6aa7abd4aa0e3f6e4b88d
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Wed Feb 3 22:11:46 EST 2016

libmp: handle out of memory case in gmfield()

--- a/sys/src/libmp/port/gmfield.c
+++ b/sys/src/libmp/port/gmfield.c
@@ -96,6 +96,9 @@
 	M = mpcopy(N);
 	C = malloc(sizeof(int)*(d+1));
 	X = malloc(sizeof(int)*(d*d));
+	if(C == nil || X == nil)
+		goto out;
+
 	for(i=0; i<=d; i++){
 		if((M->p[i]>>8) != 0 && (~M->p[i]>>8) != 0)
 			goto out;