Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove ffi.gc for http_parser_url #366

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions turbo/httputil.lua
Original file line number Diff line number Diff line change
Expand Up @@ -141,17 +141,12 @@ function httputil.HTTPParser:parse_url(url)
if type(url) ~= "string" then
error("URL parameter is not a string")
end
local htpurl = ffi.C.malloc(ffi.sizeof("struct http_parser_url"))
if htpurl == nil then
error("Could not allocate memory")
end
self.http_parser_url = ffi.cast("struct http_parser_url *", htpurl)
ffi.gc(self.http_parser_url, ffi.C.free)
self.http_parser_url = ffi.new("struct http_parser_url")
local rc = libturbo_parser.http_parser_parse_url(
url,
url:len(),
0,
self.http_parser_url)
ffi.cast("struct http_parser_url *", self.http_parser_url))
if rc ~= 0 then
error("Could not parse URL")
end
Expand Down