* syntax.c (edit_read_syntax_rules): Zero edit->rules on allocation to

avoid crash after attempting to load a non existent syntax file.
This commit is contained in:
Leonard den Ottolander 2006-04-03 21:22:09 +00:00
parent 294e05e70e
commit d5a17b01f8
2 changed files with 6 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2006-04-03 Pavel Tsekov <ptsekov@gmx.net>
* syntax.c (edit_read_syntax_rules): Zero edit->rules on allocation to
avoid crash after attempting to load a non existent syntax file.
2006-03-21 Leonard den Ottolander <leonard den ottolander nl>
* choosesyntax.c: Sort syntax list.

View File

@ -708,7 +708,7 @@ edit_read_syntax_rules (WEdit *edit, FILE *f, char **args, int args_size)
strcpy (whole_left, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_01234567890");
strcpy (whole_right, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_01234567890");
r = edit->rules = g_malloc (alloc_contexts * sizeof (struct context_rule *));
r = edit->rules = g_malloc0 (alloc_contexts * sizeof (struct context_rule *));
if (!edit->defines)
edit->defines = g_tree_new ((GCompareFunc) strcmp);