diff --git a/lualib-src/lua-skynet.c b/lualib-src/lua-skynet.c index fe909a44..1424c92d 100644 --- a/lualib-src/lua-skynet.c +++ b/lualib-src/lua-skynet.c @@ -399,6 +399,9 @@ static int _trace_new(lua_State *L) { struct trace_pool *p = lua_touserdata(L,1); struct trace_info *t = trace_new(p); + if (t==NULL) { + return luaL_error(L, "Last trace didn't close"); + } lua_pushlightuserdata(L,t); return 1; } diff --git a/lualib-src/trace_service.c b/lualib-src/trace_service.c index 453f2202..23deb40f 100644 --- a/lualib-src/trace_service.c +++ b/lualib-src/trace_service.c @@ -81,7 +81,9 @@ trace_release(struct trace_pool *p) { struct trace_info * trace_new(struct trace_pool *p) { - assert(p->current == NULL); + if (p->current) { + return NULL; + } struct trace_info *t = malloc(sizeof(*t)); p->current = t; t->session = 0;