diff options
-rw-r--r-- | src/testdir/test_tagjump.vim | 9 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/window.c | 7 |
3 files changed, 18 insertions, 0 deletions
diff --git a/src/testdir/test_tagjump.vim b/src/testdir/test_tagjump.vim index 97670bcfce..8b19c634d4 100644 --- a/src/testdir/test_tagjump.vim +++ b/src/testdir/test_tagjump.vim @@ -1392,6 +1392,15 @@ func Test_macro_search() close! endfunc +func Test_define_search() + " this was accessing freed memory + new + call setline(1, ['first line', '', '#define something 0']) + sil norm o0 + sil! norm + bwipe! +endfunc + " Test for [*, [/, ]* and ]/ func Test_comment_search() new diff --git a/src/version.c b/src/version.c index 854de45972..37e3d80f86 100644 --- a/src/version.c +++ b/src/version.c @@ -747,6 +747,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 4979, +/**/ 4978, /**/ 4977, diff --git a/src/window.c b/src/window.c index fca0eea329..984fb4631c 100644 --- a/src/window.c +++ b/src/window.c @@ -579,9 +579,16 @@ wingotofile: CHECK_CMDWIN; if ((len = find_ident_under_cursor(&ptr, FIND_IDENT)) == 0) break; + + // Make a copy, if the line was changed it will be freed. + ptr = vim_strnsave(ptr, len); + if (ptr == NULL) + break; + find_pattern_in_path(ptr, 0, len, TRUE, Prenum == 0 ? TRUE : FALSE, type, Prenum1, ACTION_SPLIT, (linenr_T)1, (linenr_T)MAXLNUM); + vim_free(ptr); curwin->w_set_curswant = TRUE; break; #endif |