comparison src/screen.c @ 10690:206ab11fa76e v8.0.0235

patch 8.0.0235: memory leak in diff mode commit https://github.com/vim/vim/commit/b031c4ea04eb1e37a873fbb85e90d835aa1e2b1c Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jan 24 20:14:48 2017 +0100 patch 8.0.0235: memory leak in diff mode Problem: Memory leak detected when running tests for diff mode. Solution: Free p_extra_free.
author Christian Brabandt <cb@256bit.org>
date Tue, 24 Jan 2017 20:15:04 +0100
parents c7f671dfd735
children dd93e5439ffd
comparison
equal deleted inserted replaced
10689:014e96879a1d 10690:206ab11fa76e
3649 draw_state = WL_FOLD; 3649 draw_state = WL_FOLD;
3650 if (fdc > 0) 3650 if (fdc > 0)
3651 { 3651 {
3652 /* Draw the 'foldcolumn'. Allocate a buffer, "extra" may 3652 /* Draw the 'foldcolumn'. Allocate a buffer, "extra" may
3653 * already be in use. */ 3653 * already be in use. */
3654 vim_free(p_extra_free);
3654 p_extra_free = alloc(12 + 1); 3655 p_extra_free = alloc(12 + 1);
3655 3656
3656 if (p_extra_free != NULL) 3657 if (p_extra_free != NULL)
3657 { 3658 {
3658 fill_foldcolumn(p_extra_free, wp, FALSE, lnum); 3659 fill_foldcolumn(p_extra_free, wp, FALSE, lnum);
4693 #endif 4694 #endif
4694 c = lcs_tab1; 4695 c = lcs_tab1;
4695 p = alloc((unsigned)(len + 1)); 4696 p = alloc((unsigned)(len + 1));
4696 vim_memset(p, ' ', len); 4697 vim_memset(p, ' ', len);
4697 p[len] = NUL; 4698 p[len] = NUL;
4699 vim_free(p_extra_free);
4698 p_extra_free = p; 4700 p_extra_free = p;
4699 for (i = 0; i < tab_len; i++) 4701 for (i = 0; i < tab_len; i++)
4700 { 4702 {
4701 #ifdef FEAT_MBYTE 4703 #ifdef FEAT_MBYTE
4702 mb_char2bytes(lcs_tab2, p); 4704 mb_char2bytes(lcs_tab2, p);
4855 c = *p_extra; 4857 c = *p_extra;
4856 p = alloc((unsigned)n_extra + 1); 4858 p = alloc((unsigned)n_extra + 1);
4857 vim_memset(p, ' ', n_extra); 4859 vim_memset(p, ' ', n_extra);
4858 STRNCPY(p, p_extra + 1, STRLEN(p_extra) - 1); 4860 STRNCPY(p, p_extra + 1, STRLEN(p_extra) - 1);
4859 p[n_extra] = NUL; 4861 p[n_extra] = NUL;
4862 vim_free(p_extra_free);
4860 p_extra_free = p_extra = p; 4863 p_extra_free = p_extra = p;
4861 } 4864 }
4862 else 4865 else
4863 #endif 4866 #endif
4864 { 4867 {
5782 capcol_lnum = lnum + 1; 5785 capcol_lnum = lnum + 1;
5783 cap_col = 0; 5786 cap_col = 0;
5784 } 5787 }
5785 #endif 5788 #endif
5786 5789
5790 vim_free(p_extra_free);
5787 return row; 5791 return row;
5788 } 5792 }
5789 5793
5790 #ifdef FEAT_MBYTE 5794 #ifdef FEAT_MBYTE
5791 static int comp_char_differs(int, int); 5795 static int comp_char_differs(int, int);