ref: d6eb7cc71c89762694fad552aa21489c55bf0a29
parent: 27fb90eb6e2e277849efca83405a75bc3c724b50
author: cinap_lenrek <[email protected]>
date: Sat Jun 13 13:50:26 EDT 2015
kernel: dont use smalloc() to allocate pte array in ibrk() when we'r out of kernel memory, it is probably better to let that alloc fail instead of hanging while holding the segment qlock.
--- a/sys/src/9/port/segment.c
+++ b/sys/src/9/port/segment.c
@@ -437,7 +437,11 @@
}
mapsize = ROUND(newsize, PTEPERTAB)/PTEPERTAB;
if(mapsize > s->mapsize){
- map = smalloc(mapsize*sizeof(Pte*));
+ map = malloc(mapsize*sizeof(Pte*));
+ if(map == nil){
+ qunlock(s);
+ error(Enomem);
+ }
memmove(map, s->map, s->mapsize*sizeof(Pte*));
if(s->map != s->ssegmap)
free(s->map);