Skip to content

Commit

Permalink
Merge pull request #24 from Hoops/fix-occasional-segv-in-free
Browse files Browse the repository at this point in the history
Prevent occasional SEGV when freeing list
  • Loading branch information
anjia0532 authored Mar 30, 2020
2 parents be2f319 + ea529cd commit 30a7466
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/resty/maxminddb.lua
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,9 @@ function _M.lookup(ip)
return nil,'get entry data failed: ' .. mmdb_strerror(status)
end

local head = entry_data_list[0] -- Save so this can be passed to free fn.
local _,status,result = _dump_entry_data_list(entry_data_list)
maxm.MMDB_free_entry_data_list(entry_data_list[0])
maxm.MMDB_free_entry_data_list(head)

if status ~= MMDB_SUCCESS then
return nil,'dump entry data failed: ' .. mmdb_strerror(status)
Expand Down

0 comments on commit 30a7466

Please sign in to comment.