diff options
author | Jurica Bradaric <jbradaric@gmail.com> | 2017-07-16 17:32:32 +0200 |
---|---|---|
committer | Jurica Bradaric <jbradaric@gmail.com> | 2017-07-16 17:48:50 +0200 |
commit | 875c356a83b07573b87b2995478fc3b0703bc023 (patch) | |
tree | 6b7f130a97ee56c4891fc9dbbed04faddf256f33 /src/nvim/quickfix.c | |
parent | ffa2e4354986cc12b8d44781708f0b9d51b84f31 (diff) | |
download | rneovim-875c356a83b07573b87b2995478fc3b0703bc023.tar.gz rneovim-875c356a83b07573b87b2995478fc3b0703bc023.tar.bz2 rneovim-875c356a83b07573b87b2995478fc3b0703bc023.zip |
vim-patch:8.0.0079
Problem: Accessing freed memory in quickfix. (Domenique Pelle)
Solution: Do not free the current list when adding to it.
https://github.com/vim/vim/commit/2b946c9f9b0e0fd805fb8f3e4c16e0a68ae13129
Diffstat (limited to 'src/nvim/quickfix.c')
-rw-r--r-- | src/nvim/quickfix.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index 6814ca855b..44469a77df 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -972,6 +972,7 @@ qf_init_ext( NULL, 0, 0 }; qffields_T fields = { NULL, NULL, 0, 0L, 0, false, NULL, 0, 0, 0 }; qfline_T *old_last = NULL; + bool adding = false; static efm_T *fmt_first = NULL; char_u *efm; static char_u *last_efm = NULL; @@ -997,6 +998,7 @@ qf_init_ext( qf_new_list(qi, qf_title); } else if (qi->qf_lists[qi->qf_curlist].qf_count > 0) { // Adding to existing list, use last entry. + adding = true; old_last = qi->qf_lists[qi->qf_curlist].qf_last; } @@ -1113,10 +1115,12 @@ qf_init_ext( } EMSG(_(e_readerrf)); error2: - qf_free(qi, qi->qf_curlist); - qi->qf_listcount--; - if (qi->qf_curlist > 0) { - qi->qf_curlist--; + if (!adding) { + qf_free(qi, qi->qf_curlist); + qi->qf_listcount--; + if (qi->qf_curlist > 0) { + qi->qf_curlist--; + } } qf_init_end: if (state.fd != NULL) { |