Skip to content
Browse files

Call xmlCleanupParser only once - when we are done with libxml

Calling xmlCleanupParser in parse-xml.c:parse_xml_buffer()
caused massive memory corruption mostly affecting gtk's FileChooser
dialogs and the application menu.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
  • Loading branch information...
1 parent 0cf3a11 commit 7226a48a8cff5637b865b64e39a6a937c20e7677 @neolit123 neolit123 committed with dirkhh Sep 18, 2012
Showing with 9 additions and 1 deletion.
  1. +1 −0 dive.h
  2. +3 −0 main.c
  3. +5 −1 parse-xml.c
View
1 dive.h
@@ -385,6 +385,7 @@ static inline struct dive *get_dive(unsigned int nr)
extern void parse_xml_init(void);
extern void parse_xml_buffer(const char *url, const char *buf, int size, GError **error);
+extern void parse_xml_exit(void);
extern void set_filename(const char *filename, gboolean force);
extern void parse_file(const char *filename, GError **error);
View
3 main.c
@@ -253,5 +253,8 @@ int main(int argc, char **argv)
show_dive_info(NULL);
run_ui();
exit_ui();
+
+ parse_xml_exit();
+
return 0;
}
View
6 parse-xml.c
@@ -1497,14 +1497,18 @@ void parse_xml_buffer(const char *url, const char *buffer, int size, GError **er
traverse(xmlDocGetRootElement(doc));
dive_end();
xmlFreeDoc(doc);
- xmlCleanupParser();
}
void parse_xml_init(void)
{
LIBXML_TEST_VERSION
}
+void parse_xml_exit(void)
+{
+ xmlCleanupParser();
+}
+
#ifdef XSLT
/* Maybe we'll want a environment variable that can override this.. */

0 comments on commit 7226a48

Please sign in to comment.
Something went wrong with that request. Please try again.