Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.openwrt.org/project/libubox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua')
-rw-r--r--lua/uloop.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lua/uloop.c b/lua/uloop.c
index 782b5a5..c5dd12f 100644
--- a/lua/uloop.c
+++ b/lua/uloop.c
@@ -325,9 +325,12 @@ static int ul_process(lua_State *L)
int argn = lua_objlen(L, -3);
int envn = lua_objlen(L, -2);
char** argp = malloc(sizeof(char*) * (argn + 2));
- char** envp = malloc(sizeof(char*) * envn + 1);
+ char** envp = malloc(sizeof(char*) * (envn + 1));
int i = 1;
+ if (!argp || !envp)
+ _exit(-1);
+
argp[0] = (char*) lua_tostring(L, -4);
for (i = 1; i <= argn; i++) {
lua_rawgeti(L, -3, i);
@@ -344,7 +347,7 @@ static int ul_process(lua_State *L)
envp[i - 1] = NULL;
execve(*argp, argp, envp);
- exit(-1);
+ _exit(-1);
}
lua_getglobal(L, "__uloop_cb");