diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-06-13 17:50:26 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-06-13 17:50:26 +0200 |
commit | d6eb7cc71c89762694fad552aa21489c55bf0a29 (patch) | |
tree | 90aac1fce9983b22b3851c25b48fa8c9182606b4 /sys/src/9/port/segment.c | |
parent | 27fb90eb6e2e277849efca83405a75bc3c724b50 (diff) |
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.
Diffstat (limited to 'sys/src/9/port/segment.c')
-rw-r--r-- | sys/src/9/port/segment.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/src/9/port/segment.c b/sys/src/9/port/segment.c index 299d8c96b..c2ad137f1 100644 --- a/sys/src/9/port/segment.c +++ b/sys/src/9/port/segment.c @@ -437,7 +437,11 @@ ibrk(uintptr addr, int seg) } 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); |