fix memory leak when reproc_start() fails

This commit is contained in:
takase1121 2021-07-08 11:22:33 +08:00
parent 453df84c82
commit 81157b5d4f
1 changed files with 4 additions and 1 deletions

View File

@ -140,7 +140,10 @@ static int process_start(lua_State* L)
} }
); );
ASSERT_REPROC_ERRNO(L, out); if (out < 0) {
reproc_destroy(proc);
L_RETURN_REPROC_ERROR(L, out);
}
process_t* self = lua_newuserdata(L, sizeof(process_t)); process_t* self = lua_newuserdata(L, sizeof(process_t));
self->process = proc; self->process = proc;