loop: Free the parent queue last when destroying the loop

This avoids a heap-use-after-free ASAN error. Close #3334
This commit is contained in:
Thiago de Arruda 2015-09-16 02:48:10 -03:00
parent 5613b62224
commit 22ea2900d0
2 changed files with 15 additions and 1 deletions

View File

@ -86,9 +86,9 @@ void loop_close(Loop *loop)
do {
uv_run(&loop->uv, UV_RUN_DEFAULT);
} while (uv_loop_close(&loop->uv));
queue_free(loop->events);
queue_free(loop->fast_events);
queue_free(loop->thread_events);
queue_free(loop->events);
kl_destroy(WatcherPtr, loop->children);
}

View File

@ -0,0 +1,14 @@
local helpers = require('test.functional.helpers')
local execute, eq, clear = helpers.execute, helpers.eq, helpers.clear
describe(':qa', function()
before_each(function()
clear('qa')
end)
it('verify #3334', function()
-- just testing if 'qa' passed as a program argument wont result in memory
-- errors
end)
end)