[devhelp/gnome-2-28] Fix leak of parser->base
- From: Jonathon Jongsma <jjongsma src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [devhelp/gnome-2-28] Fix leak of parser->base
- Date: Wed, 30 Sep 2009 15:36:43 +0000 (UTC)
commit 9e4e18b011b1a0177fe7f3f4b5d832dc66fcb3c9
Author: Jonathon Jongsma <jonathon quotidian org>
Date: Tue Sep 29 16:13:25 2009 -0500
Fix leak of parser->base
There's no need to keep base as a member of the parser struct. Just keep it as
a local variable and make sure to free it when we're done
https://bugzilla.gnome.org/show_bug.cgi?id=596808
(cherry picked from commit 64dd5755f7622b6dfa170e731f18a8b5e9a75197)
src/dh-parser.c | 14 ++++++--------
1 files changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/src/dh-parser.c b/src/dh-parser.c
index 949ffcd..a9cadcc 100644
--- a/src/dh-parser.c
+++ b/src/dh-parser.c
@@ -38,7 +38,6 @@ typedef struct {
GMarkupParseContext *context;
const gchar *path;
- gchar *base;
/* Top node of book */
GNode *book_node;
@@ -67,7 +66,7 @@ parser_start_node_book (DhParser *parser,
gint i, j;
gint line, col;
gchar *title = NULL;
- const gchar *base = NULL;
+ gchar *base = NULL;
const gchar *name = NULL;
const gchar *uri = NULL;
const gchar *lang = NULL;
@@ -111,7 +110,7 @@ parser_start_node_book (DhParser *parser,
}
}
else if (g_ascii_strcasecmp (attribute_names[i], "base") == 0) {
- base = attribute_values[i];
+ base = g_strdup (attribute_values[i]);
}
else if (g_ascii_strcasecmp (attribute_names[i], "link") == 0) {
uri = attribute_values[i];
@@ -133,19 +132,18 @@ parser_start_node_book (DhParser *parser,
return;
}
- if (base) {
- parser->base = g_strdup (base);
- } else {
- parser->base = g_path_get_dirname (parser->path);
+ if (!base) {
+ base = g_path_get_dirname (parser->path);
}
link = dh_link_new (DH_LINK_TYPE_BOOK,
- parser->base,
+ base,
name,
title,
NULL,
NULL,
uri);
+ g_free (base);
*parser->keywords = g_list_prepend (*parser->keywords, link);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]