From: Vladimír Čunát Date: Wed, 12 Sep 2018 06:51:50 +0000 (+0200) Subject: cache.clear('name'): fix a small GC race X-Git-Tag: v3.1.0~4^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e73af5d1b7375e446b597f28764bac21b1d676d;p=thirdparty%2Fknot-resolver.git cache.clear('name'): fix a small GC race Thanks to Marek for noticing it. --- diff --git a/daemon/lua/sandbox.lua b/daemon/lua/sandbox.lua index 131732402..f10d5a777 100644 --- a/daemon/lua/sandbox.lua +++ b/daemon/lua/sandbox.lua @@ -184,13 +184,13 @@ cache.clear = function (name, exact_name, rr_type, chunk_size, callback, prev_st local ret = ffi.C.kr_cache_closest_apex(cach, dname, false, apex_array) if ret < 0 then error(ffi.string(ffi.C.knot_strerror(ret))) end - ffi.gc(apex_array[0], ffi.C.free) if not ffi.C.knot_dname_is_equal(apex_array[0], dname) then local apex_str = kres.dname2str(apex_array[0]) rettable.not_apex = 'to clear proofs of non-existence call ' .. 'cache.clear(\'' .. tostring(apex_str) ..'\')' rettable.subtree = apex_str end + ffi.C.free(apex_array[0]) end if rr_type ~= nil then