Skip to content

Commit 9f84ded

Browse files
committed
patch 8.1.0488: using freed memory in quickfix code
Problem: Using freed memory in quickfix code. (Dominique Pelle) Solution: Add the quickfix_busy() flag to postpone deleting quickfix lists until it is safe. (Yegappan Lakshmanan, closes #3538)
1 parent 4c5d815 commit 9f84ded

5 files changed

Lines changed: 196 additions & 22 deletions

File tree

src/misc2.c

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,18 +1231,18 @@ free_all_mem(void)
12311231
buf = firstbuf;
12321232
}
12331233

1234-
#ifdef FEAT_ARABIC
1234+
# ifdef FEAT_ARABIC
12351235
free_cmdline_buf();
1236-
#endif
1236+
# endif
12371237

12381238
/* Clear registers. */
12391239
clear_registers();
12401240
ResetRedobuff();
12411241
ResetRedobuff();
12421242

1243-
#if defined(FEAT_CLIENTSERVER) && defined(FEAT_X11)
1243+
# if defined(FEAT_CLIENTSERVER) && defined(FEAT_X11)
12441244
vim_free(serverDelayedStartName);
1245-
#endif
1245+
# endif
12461246

12471247
/* highlight info */
12481248
free_highlight();
@@ -1265,9 +1265,9 @@ free_all_mem(void)
12651265
# ifdef FEAT_JOB_CHANNEL
12661266
channel_free_all();
12671267
# endif
1268-
#ifdef FEAT_TIMERS
1268+
# ifdef FEAT_TIMERS
12691269
timer_free_all();
1270-
#endif
1270+
# endif
12711271
# ifdef FEAT_EVAL
12721272
/* must be after channel_free_all() with unrefs partials */
12731273
eval_clear();
@@ -1282,16 +1282,19 @@ free_all_mem(void)
12821282
/* screenlines (can't display anything now!) */
12831283
free_screenlines();
12841284

1285-
#if defined(USE_XSMP)
1285+
# if defined(USE_XSMP)
12861286
xsmp_close();
1287-
#endif
1288-
#ifdef FEAT_GUI_GTK
1287+
# endif
1288+
# ifdef FEAT_GUI_GTK
12891289
gui_mch_free_all();
1290-
#endif
1290+
# endif
12911291
clear_hl_tables();
12921292

12931293
vim_free(IObuff);
12941294
vim_free(NameBuff);
1295+
# ifdef FEAT_QUICKFIX
1296+
check_quickfix_busy();
1297+
# endif
12951298
}
12961299
#endif
12971300

src/proto/quickfix.pro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* quickfix.c */
22
int qf_init(win_T *wp, char_u *efile, char_u *errorformat, int newlist, char_u *qf_title, char_u *enc);
33
void qf_free_all(win_T *wp);
4+
void check_quickfix_busy(void);
45
void copy_loclist_stack(win_T *from, win_T *to);
56
void qf_jump(qf_info_T *qi, int dir, int errornr, int forceit);
67
void qf_list(exarg_T *eap);

0 commit comments

Comments
 (0)