X-Git-Url: https://jfr.im/git/irc/quakenet/newserv.git/blobdiff_plain/0e54e92ae9fc166bc93f234669db25c8de888700..cb5aa4cdd6af4114b18db464f022ef99a44304d7:/lua/luasocket.c diff --git a/lua/luasocket.c b/lua/luasocket.c index 8e461f1a..3aa6f6e5 100644 --- a/lua/luasocket.c +++ b/lua/luasocket.c @@ -41,13 +41,13 @@ static int lua_socket_unix_connect(lua_State *l) { if(!path) return 0; - ls = (lua_socket *)malloc(sizeof(lua_socket)); + ls = (lua_socket *)luamalloc(sizeof(lua_socket)); if(!ls) return 0; ls->fd = socket(AF_UNIX, SOCK_STREAM, 0); if(ls->fd <= -1) { - free(ls); + luafree(ls); return 0; } @@ -61,14 +61,14 @@ static int lua_socket_unix_connect(lua_State *l) { /* WTB exceptions */ ret = fcntl(ls->fd, F_GETFL, 0); if(ret < 0) { - free(ls); + luafree(ls); close(ls->fd); return 0; } ret = fcntl(ls->fd, F_SETFL, ret | O_NONBLOCK); if(ret < 0) { - free(ls); + luafree(ls); close(ls->fd); return 0; } @@ -79,7 +79,7 @@ static int lua_socket_unix_connect(lua_State *l) { } else if(ret == -1 && (errno == EINPROGRESS)) { ls->state = SOCKET_CONNECTING; } else { - free(ls); + luafree(ls); close(ls->fd); return 0; } @@ -147,7 +147,7 @@ static void lua_socket_call_close(lua_socket *ls) { luaL_unref(ls->l->l, LUA_REGISTRYINDEX, ls->tag); luaL_unref(ls->l->l, LUA_REGISTRYINDEX, ls->handler); - free(ls); + luafree(ls); return; } }