From b2dc9932c2032a2d5c043639d947797dab33d8d4 Mon Sep 17 00:00:00 2001 From: Radek Doulik Date: Thu, 2 Aug 2001 10:25:36 +0000 Subject: avoid freed memory reading, when you call it like 2001-08-02 Radek Doulik * gal/e-text/e-completion-match.c (e_completion_match_set_text): avoid freed memory reading, when you call it like e_completion_match_set_text (match, e_completion_match_get_match_text (match), tmp); svn path=/trunk/; revision=11571 --- widgets/text/e-completion-match.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'widgets') diff --git a/widgets/text/e-completion-match.c b/widgets/text/e-completion-match.c index cfc7c88cd7..6e7863f887 100644 --- a/widgets/text/e-completion-match.c +++ b/widgets/text/e-completion-match.c @@ -84,10 +84,13 @@ e_completion_match_set_text (ECompletionMatch *match, const gchar *match_text, const gchar *menu_text) { + gchar *to_be_freed_match_text; + gchar *to_be_freed_menu_text; + g_return_if_fail (match != NULL); - g_free (match->match_text); - g_free (match->menu_text); + to_be_freed_match_text = match->match_text; + to_be_freed_menu_text = match->menu_text; if (match_text == NULL) { match_text = "Unknown_Match"; @@ -103,6 +106,9 @@ e_completion_match_set_text (ECompletionMatch *match, match->match_text = g_strdup (match_text); match->menu_text = g_strdup (menu_text); + + g_free (to_be_freed_match_text); + g_free (to_be_freed_menu_text); } const gchar * -- cgit v1.2.3