* 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.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
( 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
MICRO_VERSION=6
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=21
+EXTRA_VERSION=22
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
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);
}
}