aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/openssl.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/openssl.c b/src/openssl.c
index 7b2ce89..8977234 100644
--- a/src/openssl.c
+++ b/src/openssl.c
@@ -1185,6 +1185,15 @@ static void ex_newstate(lua_State *L) {
struct ex_state *state;
struct lua_State *thr;
+ lua_pushlightuserdata(L, (void *)&ex__gc);
+ lua_gettable(L, LUA_REGISTRYINDEX);
+
+ if (!lua_isnil(L, -1)) {
+ lua_pop(L, 1);
+
+ return;
+ }
+
state = prepudata(L, sizeof *state, NULL, &ex__gc);
LIST_INIT(&state->data);