diff options
author | Dan Winship <danw@src.gnome.org> | 2001-04-19 02:04:13 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2001-04-19 02:04:13 +0800 |
commit | 0c90cd7ddae8e37d4c4ab85a2b2460b4d5dd0902 (patch) | |
tree | c4d01056c13f914755c7f6393d31ba841a0222ba | |
parent | 765e7194f1459f226b91ffc027024553e2d1a64b (diff) | |
download | gsoc2013-evolution-0c90cd7ddae8e37d4c4ab85a2b2460b4d5dd0902.tar.gz gsoc2013-evolution-0c90cd7ddae8e37d4c4ab85a2b2460b4d5dd0902.tar.zst gsoc2013-evolution-0c90cd7ddae8e37d4c4ab85a2b2460b4d5dd0902.zip |
Plug memory leaks.
* filter-colour.c, filter-datespec.c, filter-folder.c,
filter-input.c, filter-option.c, filter-rule.c, filter-score.c,
filter-source.c, score-rule.c (xml_decode): Plug memory leaks.
* rule-context.c (rule_context_finalise): Implement. Free stuff.
* filter-element.h: #include <gnome-xml/xmlmemory.h> here for xmlFree
* filter-filter.c, filter-part.c: Remove xmlmemory.h #include
svn path=/trunk/; revision=9451
-rw-r--r-- | filter/ChangeLog | 12 | ||||
-rw-r--r-- | filter/filter-colour.c | 2 | ||||
-rw-r--r-- | filter/filter-datespec.c | 5 | ||||
-rw-r--r-- | filter/filter-element.h | 1 | ||||
-rw-r--r-- | filter/filter-filter.c | 1 | ||||
-rw-r--r-- | filter/filter-folder.c | 3 | ||||
-rw-r--r-- | filter/filter-input.c | 10 | ||||
-rw-r--r-- | filter/filter-option.c | 2 | ||||
-rw-r--r-- | filter/filter-part.c | 1 | ||||
-rw-r--r-- | filter/filter-rule.c | 5 | ||||
-rw-r--r-- | filter/filter-score.c | 7 | ||||
-rw-r--r-- | filter/filter-source.c | 6 | ||||
-rw-r--r-- | filter/rule-context.c | 27 | ||||
-rw-r--r-- | filter/score-rule.c | 1 |
14 files changed, 62 insertions, 21 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog index 649a21fa5a..427d996275 100644 --- a/filter/ChangeLog +++ b/filter/ChangeLog @@ -1,3 +1,15 @@ +2001-04-18 Dan Winship <danw@ximian.com> + + * filter-colour.c, filter-datespec.c, filter-folder.c, + filter-input.c, filter-option.c, filter-rule.c, filter-score.c, + filter-source.c, score-rule.c (xml_decode): Plug memory leaks. + + * rule-context.c (rule_context_finalise): Implement. Free stuff. + + * filter-element.h: #include <gnome-xml/xmlmemory.h> here for xmlFree + + * filter-filter.c, filter-part.c: Remove xmlmemory.h #include + 2001-04-15 Jeffrey Stedfast <fejj@ximian.com> * filtertypes.xml: s/Is/is/ and s/Is Not/is not/ to be more diff --git a/filter/filter-colour.c b/filter/filter-colour.c index 437621fd5e..bebc83453c 100644 --- a/filter/filter-colour.c +++ b/filter/filter-colour.c @@ -23,7 +23,6 @@ #endif #include <gtk/gtksignal.h> -#include <gnome-xml/xmlmemory.h> #include <libgnomeui/gnome-color-picker.h> #include "e-util/e-sexp.h" @@ -179,6 +178,7 @@ static int xml_decode(FilterElement *fe, xmlNodePtr node) { FilterColour *fc = (FilterColour *)fe; + xmlFree (fe->name); fe->name = xmlGetProp(node, "name"); fc->r = get_value(node, "red"); fc->g = get_value(node, "green"); diff --git a/filter/filter-datespec.c b/filter/filter-datespec.c index 49027d2afd..857194ebb3 100644 --- a/filter/filter-datespec.c +++ b/filter/filter-datespec.c @@ -244,6 +244,7 @@ xml_decode (FilterElement *fe, xmlNodePtr node) d(printf ("Decoding datespec from xml %p\n", fe)); + xmlFree (fe->name); fe->name = xmlGetProp (node, "name"); n = node->childs; @@ -251,10 +252,10 @@ xml_decode (FilterElement *fe, xmlNodePtr node) if (!strcmp (n->name, "datespec")) { val = xmlGetProp (n, "type"); fds->type = atoi (val); - g_free (val); + xmlFree (val); val = xmlGetProp (n, "value"); fds->value = atoi (val); - g_free (val); + xmlFree (val); break; } n = n->next; diff --git a/filter/filter-element.h b/filter/filter-element.h index 11c5f66286..1ed6c431f0 100644 --- a/filter/filter-element.h +++ b/filter/filter-element.h @@ -24,6 +24,7 @@ #include <gtk/gtkobject.h> #include <gtk/gtkwidget.h> #include <gnome-xml/parser.h> +#include <gnome-xml/xmlmemory.h> #define FILTER_ELEMENT(obj) GTK_CHECK_CAST (obj, filter_element_get_type (), FilterElement) #define FILTER_ELEMENT_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, filter_element_get_type (), FilterElementClass) diff --git a/filter/filter-filter.c b/filter/filter-filter.c index bbb57cee49..96d444528b 100644 --- a/filter/filter-filter.c +++ b/filter/filter-filter.c @@ -29,7 +29,6 @@ #include <gtk/gtkoptionmenu.h> #include <gtk/gtkscrolledwindow.h> #include <gtk/gtktable.h> -#include <gnome-xml/xmlmemory.h> #include <libgnome/gnome-defs.h> #include <libgnome/gnome-i18n.h> #include <libgnomeui/gnome-stock.h> diff --git a/filter/filter-folder.c b/filter/filter-folder.c index 9176492baf..a16aa0c795 100644 --- a/filter/filter-folder.c +++ b/filter/filter-folder.c @@ -187,11 +187,14 @@ xml_decode (FilterElement *fe, xmlNodePtr node) d(printf ("Decoding folder from xml %p\n", fe)); + xmlFree (fe->name); fe->name = xmlGetProp (node, "name"); n = node->childs; while (n) { if (!strcmp (n->name, "folder")) { + xmlFree (ff->name); + xmlFree (ff->uri); ff->name = xmlGetProp (n, "name"); ff->uri = xmlGetProp (n, "uri"); break; diff --git a/filter/filter-input.c b/filter/filter-input.c index 6c06849d2b..da04195f62 100644 --- a/filter/filter-input.c +++ b/filter/filter-input.c @@ -27,7 +27,6 @@ #include <gtk/gtkobject.h> #include <gtk/gtkwidget.h> -#include <gnome-xml/xmlmemory.h> #include <libgnome/gnome-defs.h> #include <libgnome/gnome-i18n.h> #include <libgnomeui/gnome-dialog.h> @@ -255,14 +254,15 @@ xml_decode (FilterElement *fe, xmlNodePtr node) char *name, *str, *type; xmlNodePtr n; - type = fi->type ? fi->type : "string"; + name = xmlGetProp (node, "name"); + type = xmlGetProp (node, "type"); d(printf("Decoding %s from xml %p\n", type, fe)); - - name = xmlGetProp (node, "name"); d(printf ("Name = %s\n", name)); + xmlFree (fe->name); fe->name = name; - fi->type = xmlGetProp (node, "type"); + xmlFree (fi->type); + fi->type = type; n = node->childs; while (n) { if (!strcmp (n->name, type)) { diff --git a/filter/filter-option.c b/filter/filter-option.c index aa26741ac9..a5e0b5671d 100644 --- a/filter/filter-option.c +++ b/filter/filter-option.c @@ -24,7 +24,6 @@ #include <glib.h> #include <gtk/gtkmenuitem.h> #include <gtk/gtkoptionmenu.h> -#include <gnome-xml/xmlmemory.h> #include <libgnome/gnome-defs.h> #include <libgnome/gnome-i18n.h> #include <gal/widgets/e-unicode.h> @@ -234,6 +233,7 @@ xml_decode (FilterElement *fe, xmlNodePtr node) char *value; d(printf ("Decoding option from xml\n")); + xmlFree (fe->name); fe->name = xmlGetProp (node, "name"); value = xmlGetProp (node, "value"); if (value) { diff --git a/filter/filter-part.c b/filter/filter-part.c index c4cc6888b9..f23df4d437 100644 --- a/filter/filter-part.c +++ b/filter/filter-part.c @@ -26,7 +26,6 @@ #include <glib.h> #include <gtk/gtkbox.h> #include <gtk/gtkhbox.h> -#include <gnome-xml/xmlmemory.h> #include <libgnome/gnome-defs.h> #include <libgnome/gnome-i18n.h> #include <gal/widgets/e-unicode.h> diff --git a/filter/filter-rule.c b/filter/filter-rule.c index 10d583b58a..d8f8d419e5 100644 --- a/filter/filter-rule.c +++ b/filter/filter-rule.c @@ -29,7 +29,6 @@ #include <gtk/gtkoptionmenu.h> #include <gtk/gtkscrolledwindow.h> #include <gtk/gtktable.h> -#include <gnome-xml/xmlmemory.h> #include <libgnome/gnome-defs.h> #include <libgnome/gnome-i18n.h> #include <libgnomeui/gnome-stock.h> @@ -319,9 +318,11 @@ xml_decode (FilterRule *fr, xmlNodePtr node, RuleContext *f) fr->grouping = FILTER_GROUP_ALL; xmlFree (grouping); + g_free (fr->source); source = xmlGetProp (node, "source"); if (source) { - fr->source = source; + fr->source = g_strdup (source); + xmlFree (source); } else { /* default filter type */ fr->source = g_strdup ("incoming"); diff --git a/filter/filter-score.c b/filter/filter-score.c index 56d41f5759..d60a006afa 100644 --- a/filter/filter-score.c +++ b/filter/filter-score.c @@ -27,7 +27,6 @@ #include <stdlib.h> #include <gtk/gtksignal.h> #include <gtk/gtkspinbutton.h> -#include <gnome-xml/xmlmemory.h> #include "e-util/e-sexp.h" #include "filter-score.h" @@ -174,11 +173,13 @@ xml_decode (FilterElement *fe, xmlNodePtr node) name = xmlGetProp (node, "name"); d(printf ("Name = %s\n", name)); + xmlFree (fe->name); fe->name = name; score = xmlGetProp (node, name); - if (score) + if (score) { fs->score = atoi (score); - else + xmlFree (score); + } else fs->score = 0; if (fs->score > 3) diff --git a/filter/filter-source.c b/filter/filter-source.c index eadf931b84..83428fe09c 100644 --- a/filter/filter-source.c +++ b/filter/filter-source.c @@ -154,8 +154,6 @@ filter_source_new (void) static void xml_create (FilterElement *fe, xmlNodePtr node) { - FilterSource *fs = (FilterSource *) fe; - /* Call parent implementation */ ((FilterElementClass *)parent_class)->xml_create (fe, node); @@ -192,8 +190,10 @@ xml_decode (FilterElement *fe, xmlNodePtr node) FilterSource *fs = (FilterSource *) fe; gchar *value; + xmlFree (fe->name); fe->name = xmlGetProp (node, "name"); value = xmlGetProp (node, "uri"); + xmlFree (fs->priv->current_url); fs->priv->current_url = value; return 0; @@ -284,8 +284,6 @@ get_widget (FilterElement *fe) static void build_code (FilterElement *fe, GString *out, struct _FilterPart *ff) { - FilterSource *fs = (FilterSource *) fe; - g_message ("build_code: [%s]", out->str); } diff --git a/filter/rule-context.c b/filter/rule-context.c index 5ab201c64a..3f121de572 100644 --- a/filter/rule-context.c +++ b/filter/rule-context.c @@ -106,8 +106,33 @@ static void rule_context_finalise(GtkObject * obj) { RuleContext *o = (RuleContext *) obj; + struct _part_set_map *psm; + struct _rule_set_map *rsm; + GList *next; + + g_free(o->priv); + g_hash_table_destroy(o->part_set_map); + g_hash_table_destroy(o->rule_set_map); + + for (; o->part_set_list; o->part_set_list = next) { + psm = o->part_set_list->data; + g_free (psm->name); + g_free (psm); + next = o->part_set_list->next; + g_list_free_1 (o->part_set_list); + } + for (; o->rule_set_list; o->rule_set_list = next) { + rsm = o->rule_set_list->data; + g_free (rsm->name); + g_free (rsm); + next = o->rule_set_list->next; + g_list_free_1 (o->rule_set_list); + } - o = o; + if (o->system) + xmlFreeDoc(o->system); + if (o->user) + xmlFreeDoc(o->user); ((GtkObjectClass *) (parent_class))->finalize(obj); } diff --git a/filter/score-rule.c b/filter/score-rule.c index 3def7b3cee..c8b9376d44 100644 --- a/filter/score-rule.c +++ b/filter/score-rule.c @@ -164,6 +164,7 @@ xml_decode (FilterRule *fr, xmlNodePtr node, struct _RuleContext *f) if (!strcmp (value->name, "score")) { str = xmlGetProp (value, "value"); sscanf (str, "%d", &sr->score); + xmlFree (str); /* score range is -3 to +3 */ if (sr->score > 3) |