Dominique Pelle wrote:
> Valgrind memory checker detects use of freed memory in the
> Motif GUI version of Vim-7.2.267:
>
> [...]
>
> Bug can be reproduced as follows:
> - Compile Vim with Motif or lessTif.
> - Run gvim with valgrind:
> $ cd vim7/src
> $ valgrind ./vim -f -g 2> valgrind.log
> - Type Ex command: set guifont=*
> - A window pops up to select a font
> - Click any font (it does not matter which one)
> - and observe in Valgrind output the error
>
> Looking at the code, the use of freed memory is obvious:
>
> vim7/src/gui_xmdlg.c:
>
> 632 if (!data->sel[which])
> 633 data->sel[which] = XtNewString(sel);
> 634 else
> 635 {
> !636 XtFree(data->sel[which]);
> !637 if (!strcmp(data->sel[which], sel))
> 638 {
> 639 /* unselecting current selection */
> 640 data->sel[which] = NULL;
> 641 if (w)
> 642 XmListDeselectItem(w, call_data->item);
> 643 }
> 644 else
> 645 data->sel[which] = XtNewString(sel);
> 646 }
>
> 'data->sel[which]' is freed at line 636 and used immediately
> after in the next line 637.
>
> Attached patch fixes it.
Thanks, I'll include it.
--
Q: What's orange and sounds like a parrot?
A: A carrot
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---