diff options
author | Yaroslav Kolomiiets <yarikos@gmail.com> | 2017-02-28 18:31:24 +0200 |
---|---|---|
committer | Yaroslav Kolomiiets <yarikos@gmail.com> | 2017-02-28 18:31:24 +0200 |
commit | e1178c6dd91d094915c837eb2cf9c854153f00e9 (patch) | |
tree | 99a5a0558ecc1a15b3edeb8794d247d9447acb24 | |
parent | babd823cc760c8cd8a5a97b7dbbc6b53e2fdc57e (diff) |
limbo/lex.c: allocmem(0) to return a valid pointer even though malloc(0) may get nil
-rw-r--r-- | limbo/lex.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/limbo/lex.c b/limbo/lex.c index 747cfaaf..c6af1988 100644 --- a/limbo/lex.c +++ b/limbo/lex.c @@ -1434,8 +1434,8 @@ allocmem(ulong n) { void *p; - p = malloc(n); - if(p == nil && n != 0) + p = malloc(n != 0? n: 1); + if(p == nil) fatal("out of memory"); return p; } |