Mercurial > vim
comparison src/window.c @ 28913:22f743798f84 v8.2.4979
patch 8.2.4979: accessing freed memory when line is flushed
Commit: https://github.com/vim/vim/commit/28d032cc688ccfda18c5bbcab8b50aba6e18cde5
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed May 18 16:29:08 2022 +0100
patch 8.2.4979: accessing freed memory when line is flushed
Problem: Accessing freed memory when line is flushed.
Solution: Make a copy of the pattern to search for.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 18 May 2022 17:30:03 +0200 |
parents | d0241e74bfdb |
children | 45c182c4f7e9 |
comparison
equal
deleted
inserted
replaced
28912:2ca7719992c9 | 28913:22f743798f84 |
---|---|
577 case 'd': // Go to definition, using 'define' | 577 case 'd': // Go to definition, using 'define' |
578 case Ctrl_D: | 578 case Ctrl_D: |
579 CHECK_CMDWIN; | 579 CHECK_CMDWIN; |
580 if ((len = find_ident_under_cursor(&ptr, FIND_IDENT)) == 0) | 580 if ((len = find_ident_under_cursor(&ptr, FIND_IDENT)) == 0) |
581 break; | 581 break; |
582 | |
583 // Make a copy, if the line was changed it will be freed. | |
584 ptr = vim_strnsave(ptr, len); | |
585 if (ptr == NULL) | |
586 break; | |
587 | |
582 find_pattern_in_path(ptr, 0, len, TRUE, | 588 find_pattern_in_path(ptr, 0, len, TRUE, |
583 Prenum == 0 ? TRUE : FALSE, type, | 589 Prenum == 0 ? TRUE : FALSE, type, |
584 Prenum1, ACTION_SPLIT, (linenr_T)1, (linenr_T)MAXLNUM); | 590 Prenum1, ACTION_SPLIT, (linenr_T)1, (linenr_T)MAXLNUM); |
591 vim_free(ptr); | |
585 curwin->w_set_curswant = TRUE; | 592 curwin->w_set_curswant = TRUE; |
586 break; | 593 break; |
587 #endif | 594 #endif |
588 | 595 |
589 // Quickfix window only: view the result under the cursor in a new split. | 596 // Quickfix window only: view the result under the cursor in a new split. |