PATCH: anti memleak part 2
- From: Ali Akcaagac <ali akcaagac stud fh-wilhelmshaven de>
- To: balsa-list gnome org
- Subject: PATCH: anti memleak part 2
- Date: Thu, 18 Oct 2001 17:41:45 +0200
jo, subject says everything. please REVIEW the patch before
applying to CVS..
--
Name....: Ali Akcaagac
Status..: Student Of Computer & Economic Science
E-Mail..: mailto:ali.akcaagac@stud.fh-wilhelmshaven.de
WWW.....: http://www.fh-wilhelmshaven.de/~akcaagaa
diff -ruN balsa-cvs/src/save-restore.c balsa/src/save-restore.c
--- balsa-cvs/src/save-restore.c Thu Oct 18 16:38:15 2001
+++ balsa/src/save-restore.c Thu Oct 18 17:24:53 2001
@@ -1,5 +1,4 @@
/* -*-mode:c; c-style:k&r; c-basic-offset:4; -*- */
-/* vim:set ts=4 sw=4 ai et: */
/* Balsa E-Mail Client
* Copyright (C) 1997-2001 Stuart Parmenter and others,
* See the file AUTHORS for a list.
@@ -1234,12 +1233,13 @@
load_mru(GList **mru)
{
int count, i;
- char tmpkey[32];
+ gchar *tmpkey;
- count=d_get_gint("MRUCount", 0);
- for(i=0;i<count;i++) {
- sprintf(tmpkey, "MRU%d", i+1);
- (*mru)=g_list_append((*mru), gnome_config_get_string(tmpkey));
+ count = d_get_gint("MRUCount", 0);
+ for (i = 0; i < count; i++) {
+ tmpkey = g_strdup_printf("MRU%d", i + 1);
+ (*mru) = g_list_append((*mru), gnome_config_get_string(tmpkey));
+ g_free (tmpkey);
}
}
@@ -1247,13 +1247,15 @@
save_mru(GList *mru)
{
int i;
- char tmpkey[32];
+ gchar *tmpkey;
GList *ltmp;
- for(ltmp=g_list_first(balsa_app.folder_mru),i=0;
- ltmp; ltmp=g_list_next(ltmp),i++) {
- sprintf(tmpkey, "MRU%d", i+1);
+ for (ltmp = g_list_first(balsa_app.folder_mru), i = 0;
+ ltmp; ltmp = g_list_next(ltmp), i++) {
+ tmpkey = g_strdup_printf("MRU%d", i + 1);
gnome_config_set_string(tmpkey, (gchar *)(ltmp->data));
+ g_free (tmpkey);
}
+
gnome_config_set_int("MRUCount", i);
}
diff -ruN balsa-cvs/src/spell-check.c balsa/src/spell-check.c
--- balsa-cvs/src/spell-check.c Thu Oct 18 16:38:15 2001
+++ balsa/src/spell-check.c Thu Oct 18 17:15:57 2001
@@ -894,8 +894,6 @@
gint saved_start_pos;
gint saved_end_pos;
-
- new_word = NULL;
old_word = gtk_editable_get_chars(GTK_EDITABLE(spell_check->text),
spell_check->start_pos,
spell_check->end_pos);
@@ -929,7 +927,6 @@
gtk_text_freeze(spell_check->text);
switch_word(spell_check, old_word, new_word);
-
if (fix_all) {
saved_start_pos = spell_check->start_pos;
saved_end_pos = spell_check->end_pos;
@@ -1001,7 +998,6 @@
{
gint length;
-
finish_check(spell_check);
if (keep_changes) {
@@ -1055,7 +1051,6 @@
const gchar *new_word;
gchar *row_text[1];
-
wl = spell_check->word_list;
gtk_clist_freeze(spell_check->list);
spell_check->suggestions = pspell_word_list_elements(wl);
@@ -1089,19 +1084,18 @@
gboolean correct;
gchar *word = NULL;
-
word = gtk_editable_get_chars(GTK_EDITABLE(spell_check->text),
spell_check->start_pos,
spell_check->end_pos);
if (word) {
-
if (balsa_app.debug)
balsa_information(LIBBALSA_INFORMATION_DEBUG,
"BalsaSpellCheck: Check %s", word);
correct = pspell_manager_check(spell_check->spell_manager, word);
} else {
+ g_free(word);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]