libmp: handle out of memory case in gmfield()

front
cinap_lenrek 2016-02-04 03:11:46 +01:00
parent 78808ca314
commit f1254da64d
1 changed files with 3 additions and 0 deletions

View File

@ -96,6 +96,9 @@ gmfield(mpint *N)
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;