From 677cd472f1a89b782af705427a0538476b7f6cc5 Mon Sep 17 00:00:00 2001 From: gunnar_g Date: Mon, 12 Apr 2010 11:28:32 +0000 Subject: [PATCH] Fixed the memorable match seg fault, bug 2857927 --- src/user.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/user.c b/src/user.c index 4f963694..35dd4c50 100644 --- a/src/user.c +++ b/src/user.c @@ -1145,7 +1145,7 @@ user_mm_load_file(const gchar *filename, GArray *mmatches) GString *prefix = g_string_new(""); gchar filename_local[SMALL], matches_file[SMALL]; - GArray *mm_array = (mmatches == NULL) ? + GArray *mm_array = (mmatches != NULL) ? current_user.mmatches : mmatches; strcpy(filename_local, filename); @@ -1157,7 +1157,10 @@ user_mm_load_file(const gchar *filename, GArray *mmatches) file_decompress(filename_local); if(mmatches == NULL) + { free_mmatches(&mm_array, TRUE); + mm_array = g_array_new(FALSE, FALSE, sizeof(MemMatch)); + } xml_mmatches_read(matches_file, mm_array); @@ -1168,6 +1171,7 @@ user_mm_load_file(const gchar *filename, GArray *mmatches) misc_string_assign(¤t_user.mmatches_file, filename_local); g_string_free(prefix, TRUE); + current_user.mmatches = mm_array; } /** Add the last match to the MM file.