talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 3b8f4158eb6c11e3b1f87ad4cda6a493abcdea97
parent 6fe006f667c2b0a16b3dbe83a983dca72e147af0
Author: Colin Leroy <colin@colino.net>
Date:   Sun, 25 Jul 2010 15:15:49 +0000

2010-07-25 [colin]	3.7.6cvs22

	* src/common/utils.c
		And now for a real fix. g_list_remove() doesn't, of
		course, free the data. But we have to have a solid
		pointer to it in order to free it ourselves instead
		of relying on the old freed list pointer.
		Maybe that's the last patch on the subject now ? :)

Diffstat:
MChangeLog | 9+++++++++
MPATCHSETS | 1+
Mconfigure.ac | 2+-
Msrc/common/utils.c | 5+++++
4 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,12 @@ +2010-07-25 [colin] 3.7.6cvs22 + + * src/common/utils.c + And now for a real fix. g_list_remove() doesn't, of + course, free the data. But we have to have a solid + pointer to it in order to free it ourselves instead + of relying on the old freed list pointer. + Maybe that's the last patch on the subject now ? :) + 2010-07-25 [colin] 3.7.6cvs21 * src/common/utils.c diff --git a/PATCHSETS b/PATCHSETS @@ -4017,3 +4017,4 @@ ( cvs diff -u -r 1.1.2.95 -r 1.1.2.96 src/gtk/quicksearch.c; ) > 3.7.6cvs19.patchset ( cvs diff -u -r 1.36.2.184 -r 1.36.2.185 src/common/utils.c; ) > 3.7.6cvs20.patchset ( cvs diff -u -r 1.36.2.185 -r 1.36.2.186 src/common/utils.c; ) > 3.7.6cvs21.patchset +( cvs diff -u -r 1.36.2.186 -r 1.36.2.187 src/common/utils.c; ) > 3.7.6cvs22.patchset diff --git a/configure.ac b/configure.ac @@ -12,7 +12,7 @@ MINOR_VERSION=7 MICRO_VERSION=6 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=21 +EXTRA_VERSION=22 EXTRA_RELEASE= EXTRA_GTK2_VERSION= diff --git a/src/common/utils.c b/src/common/utils.c @@ -997,18 +997,23 @@ GSList *newsgroup_list_append(GSList *group_list, const gchar *str) GList *add_history(GList *list, const gchar *str) { GList *old; + gchar *oldstr; cm_return_val_if_fail(str != NULL, list); old = g_list_find_custom(list, (gpointer)str, (GCompareFunc)strcmp2); if (old) { + oldstr = old->data; list = g_list_remove(list, old->data); + g_free(oldstr); } else if (g_list_length(list) >= MAX_HISTORY_SIZE) { GList *last; last = g_list_last(list); if (last) { + oldstr = last->data; list = g_list_remove(list, last->data); + g_free(oldstr); } }