diff options
author | Kjartan Maraas <kmaraas@gnome.org> | 2005-02-08 21:12:37 +0000 |
---|---|---|
committer | Kjartan Maraas <kmaraas@src.gnome.org> | 2005-02-08 21:12:37 +0000 |
commit | e2ab6548af0a8acc641e50de43816ed3633585ac (patch) | |
tree | dccc90927a86f31b3e2880e1c2fafdd7fe352341 | |
parent | 7a80ba653332985ce1562cee3d3b66a27ee7f5a6 (diff) | |
download | yelp-e2ab6548af0a8acc641e50de43816ed3633585ac.tar.gz |
Fix leak Don't free memory until you're finished using it. Fix leaks.
2005-02-06 Kjartan Maraas <kmaraas@gnome.org>
* src/yelp-gecko-utils.cpp: Fix leak
* src/yelp-utils.c: (yelp_doc_info_new): Don't free
memory until you're finished using it.
* src/yelp-xslt-pager.c: (xslt_yelp_document): Fix leaks.
GetPropInfo already allocates a new string so there's no
need to g_strdup it again.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | src/yelp-gecko-utils.cpp | 1 | ||||
-rw-r--r-- | src/yelp-utils.c | 2 | ||||
-rw-r--r-- | src/yelp-xslt-pager.c | 6 |
4 files changed, 14 insertions, 4 deletions
@@ -1,3 +1,12 @@ +2005-02-06 Kjartan Maraas <kmaraas@gnome.org> + + * src/yelp-gecko-utils.cpp: Fix leak + * src/yelp-utils.c: (yelp_doc_info_new): Don't free + memory until you're finished using it. + * src/yelp-xslt-pager.c: (xslt_yelp_document): Fix leaks. + GetPropInfo already allocates a new string so there's no + need to g_strdup it again. + 2005-02-04 Davyd Madeley <davyd@madeley.id.au> * src/yelp-bookmarks.c: Add a missing t. diff --git a/src/yelp-gecko-utils.cpp b/src/yelp-gecko-utils.cpp index 01d0d281..85ef8001 100644 --- a/src/yelp-gecko-utils.cpp +++ b/src/yelp-gecko-utils.cpp @@ -50,6 +50,7 @@ yelp_util_split_font_string (const gchar *font_name, gchar **name, gint *size) ch = g_utf8_strrchr (tmp_name, -1, ' '); if (!ch || ch == tmp_name) { + g_free (tmp_name); return FALSE; } diff --git a/src/yelp-utils.c b/src/yelp-utils.c index cd9987f9..793101ea 100644 --- a/src/yelp-utils.c +++ b/src/yelp-utils.c @@ -97,7 +97,6 @@ yelp_doc_info_new (const gchar *uri) else doc_uri = g_strdup (full_uri); doc_type = get_doc_type (doc_uri); - g_free (doc_uri); uri_type = YELP_URI_TYPE_FILE; } else if (g_str_has_prefix (full_uri, "ghelp:") || @@ -142,6 +141,7 @@ yelp_doc_info_new (const gchar *uri) yelp_doc_info_add_uri (doc, doc_uri, YELP_URI_TYPE_FILE); if (uri_type && uri_type != YELP_URI_TYPE_FILE) yelp_doc_info_add_uri (doc, uri, uri_type); + g_free (doc_uri); doc->type = doc_type; doc->ref_count = 1; diff --git a/src/yelp-xslt-pager.c b/src/yelp-xslt-pager.c index c27a2dd4..d80c3d11 100644 --- a/src/yelp-xslt-pager.c +++ b/src/yelp-xslt-pager.c @@ -426,11 +426,11 @@ xslt_yelp_document (xsltTransformContextPtr ctxt, xmlChar *rel = xmlGetProp (cur, "rel"); if (!xmlStrcmp (rel, (xmlChar *) "previous")) - page->prev_id = g_strdup (xmlGetProp (cur, "href")); + page->prev_id = xmlGetProp (cur, "href"); else if (!xmlStrcmp (rel, (xmlChar *) "next")) - page->next_id = g_strdup (xmlGetProp (cur, "href")); + page->next_id = xmlGetProp (cur, "href"); else if (!xmlStrcmp (rel, (xmlChar *) "top")) - page->toc_id = g_strdup (xmlGetProp (cur, "href")); + page->toc_id = xmlGetProp (cur, "href"); xmlFree (rel); } |