diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2016-02-04 03:11:46 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2016-02-04 03:11:46 +0100 |
commit | f1254da64de2c728a59380644c23e9ce1a4f4351 (patch) | |
tree | 36717f66322d0ef19c23643e29bb16c565d9037d /sys/src/libmp | |
parent | 78808ca314949f40d9f6aa7abd4aa0e3f6e4b88d (diff) |
libmp: handle out of memory case in gmfield()
Diffstat (limited to 'sys/src/libmp')
-rw-r--r-- | sys/src/libmp/port/gmfield.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/src/libmp/port/gmfield.c b/sys/src/libmp/port/gmfield.c index 74e74566e..52ead4e93 100644 --- a/sys/src/libmp/port/gmfield.c +++ b/sys/src/libmp/port/gmfield.c @@ -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; |