From fbd932e8468e83318045f9e0ce5f5f960be6b4ba Mon Sep 17 00:00:00 2001 From: Cloud Wu Date: Wed, 3 Apr 2019 11:29:37 +0800 Subject: [PATCH] OOM check --- 3rd/lua/lstring.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/3rd/lua/lstring.c b/3rd/lua/lstring.c index 7e3f95a6..7c77dba6 100644 --- a/3rd/lua/lstring.c +++ b/3rd/lua/lstring.c @@ -295,6 +295,8 @@ static struct shrmap_slot * shrstr_newpage(int sz) { int i; struct shrmap_slot * s = (struct shrmap_slot *)malloc(sz * sizeof(*s)); + if (s == NULL) + return NULL; for (i=0;ilock); int succ = shrstr_allocpage(s, osz, sz, newpage); rwlock_wunlock(&s->lock);