From 27b5ef3975e22c7d62e8dbe780dc75607e36eb43 Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Sun, 12 Apr 2015 11:31:45 -0300 Subject: [PATCH] eval: Fix memory deallocation of JobEvent This causes a "read after free" error when kmp_free is replaced by `free`. --- src/nvim/eval.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nvim/eval.c b/src/nvim/eval.c index a3ef24f295..7e020a9bce 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -20313,11 +20313,11 @@ static void on_job_event(Event event) clear_tv(&rettv); end: - kmp_free(JobEventPool, job_event_pool, ev); if (!ev->received) { // exit event, safe to free job data now term_job_data_decref(ev->data); } + kmp_free(JobEventPool, job_event_pool, ev); } static void script_host_eval(char *name, typval_T *argvars, typval_T *rettv)