mc/edit
Sergei Trofimovich 4d9bc2923b Ticket #1906: edit: crash on file open whoen some Syntax files are absent (reported by pavlinux)
valgrind log snippet: (from here http://pavlinux.ru/vgmc.log)

> ==26750== HEAP SUMMARY:
> ==26750==     in use at exit: 0 bytes in 0 blocks
> ==26750==   ==26749== Invalid free() / delete / delete[]
> ==26749==    at 0x4A06DD8: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==26749==    by 0x48B5F9: edit_read_syntax_rules (syntax.c:766)
> ==26749==    by 0x48CDA7: edit_read_syntax_file (syntax.c:1140)
> ==26749==    by 0x48D06D: edit_load_syntax (syntax.c:1219)
> ==26749==    by 0x4762F6: edit_init (edit.c:834)
> ==26749==    by 0x4858FC: edit_file (editwidget.c:241)
> ==26749==    by 0x44D017: do_edit_at_line (cmd.c:304)
> ==26749==    by 0x44D098: do_edit (cmd.c:324)
> ==26749==    by 0x44D10E: edit_cmd (cmd.c:331)
> ==26749==    by 0x46C2E4: midnight_execute_cmd (main.c:1193)
> ==26749==    by 0x46CD41: midnight_callback (main.c:1690)
> ==26749==    by 0x4353F4: buttonbar_call (widget.c:2654)
> ==26749==  Address 0x60f8e10 is 0 bytes inside a block of size 30 free'd
> ==26749==    at 0x4A06DD8: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==26749==    by 0x48B32C: open_include_file (syntax.c:705)
> ==26749==    by 0x48B6E8: edit_read_syntax_rules (syntax.c:784)
> ==26749==    by 0x48CDA7: edit_read_syntax_file (syntax.c:1140)
> ==26749==    by 0x48D06D: edit_load_syntax (syntax.c:1219)
> ==26749==    by 0x4762F6: edit_init (edit.c:834)
> ==26749==    by 0x4858FC: edit_file (editwidget.c:241)
> ==26749==    by 0x44D017: do_edit_at_line (cmd.c:304)
> ==26749==    by 0x44D098: do_edit (cmd.c:324)
> ==26749==    by 0x44D10E: edit_cmd (cmd.c:331)
> ==26749==    by 0x46C2E4: midnight_execute_cmd (main.c:1193)
> ==26749==    by 0x46CD41: midnight_callback (main.c:1690)

We see doublefree memory corruption here, introduced by spurious 'g_free(error_file_name)'
of changeset:0c17219b2ab5cb5fe2e73f8d7cc9c11c755a3ae4 (syntax.c file)

The rest of code seems to store real syntax file name there.

Making code the same as part above: don't free 'error_file_name'

Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
2009-12-27 10:23:50 +02:00
..
.gitignore Added .svnignore files (same as .cvsignore) 2008-12-28 23:27:03 +02:00
bookmark.c De-inline a few functions which are large 2009-08-31 07:12:59 +03:00
choosesyntax.c Ticket #1451: fixed placement of choose encoding dialog window. 2009-10-15 11:40:30 +04:00
edit-impl.h change type of some parameters from int to long. 2009-12-25 19:44:34 +02:00
edit-widget.h Show actual shortcuts in editor menu. 2009-10-26 16:15:32 +03:00
edit.c change type of some parameters from int to long. 2009-12-25 19:44:34 +02:00
edit.h Ticket #46 (mcedit: check POSIX newline at end of file) 2009-10-27 12:08:45 +00:00
editcmd_dialogs.c Modified dialog callback function. 2009-11-19 10:07:51 +03:00
editcmd_dialogs.h Added field lb (kind of line break) into WEdit struct 2009-08-31 13:20:49 +04:00
editcmd.c change type of some parameters from int to long. 2009-12-25 19:44:34 +02:00
editdraw.c change type of some parameters from int to long. 2009-12-25 19:44:34 +02:00
editkeys.c Optimization of command handling. 2009-11-19 10:07:51 +03:00
editlock.c fixed several missing #include's 2009-06-18 21:02:29 +04:00
editlock.h Simple doxygen description for files in edit directory. 2009-02-10 16:07:59 +02:00
editmenu.c Modified menu command handling using DLG_ACTION message. 2009-11-19 10:07:51 +03:00
editoptions.c Ticket #1831: fixed compilation warings of --disable-nls and --disable-charset options. 2009-11-20 14:39:51 +03:00
editwidget.c Optimization of DLG_RESIZE message handling. 2009-12-16 11:10:42 +02:00
etags.c Ticket #1892: fixed resource leaks. 2009-12-23 22:31:30 +03:00
etags.h Reorganize work with files. Fixed permissions of files in mc home dir. All file names now accumulated into src/fileloc.h 2009-10-07 12:01:05 +03:00
Makefile.am Ticket #1649: Prepare for prerelease mc-4.7.0-pre3 (code cleanup) 2009-10-01 16:14:32 +03:00
syntax.c Ticket #1906: edit: crash on file open whoen some Syntax files are absent (reported by pavlinux) 2009-12-27 10:23:50 +02:00
wordproc.c change type of some parameters from int to long. 2009-12-25 19:44:34 +02:00