summaryrefslogtreecommitdiff
path: root/src/tre/ltre_w.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tre/ltre_w.c')
-rw-r--r--src/tre/ltre_w.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/tre/ltre_w.c b/src/tre/ltre_w.c
index 4744cb1..c335346 100644
--- a/src/tre/ltre_w.c
+++ b/src/tre/ltre_w.c
@@ -111,6 +111,8 @@ static int compile_regex (lua_State *L, const TArgComp *argC, TPosix **pud) {
if (argC->cflags & REG_NOSUB)
ud->r.re_nsub = 0;
ud->match = (regmatch_t *) Lmalloc (L, (ALG_NSUB(ud) + 1) * sizeof (regmatch_t));
+ if (!ud->match)
+ luaL_error (L, "malloc failed");
lua_pushvalue (L, ALG_ENVIRONINDEX);
lua_setmetatable (L, -2);