Added some cleanup functions

This commit is contained in:
Gergely Polonkai 2013-09-19 23:17:58 +02:00
parent d6df0e4690
commit c11bccc820

View File

@ -838,6 +838,7 @@ ag_chart_create_svg(AgChart *chart, GError **err)
g_debug("Opening %s as a stylesheet", stylesheet_path); g_debug("Opening %s as a stylesheet", stylesheet_path);
xslt_file = g_file_new_for_path(stylesheet_path); xslt_file = g_file_new_for_path(stylesheet_path);
if (!g_file_load_contents(xslt_file, NULL, &xslt, &xslt_length, NULL, err)) { if (!g_file_load_contents(xslt_file, NULL, &xslt, &xslt_length, NULL, err)) {
g_free(stylesheet_path);
xmlFreeDoc(doc); xmlFreeDoc(doc);
return NULL; return NULL;
@ -854,6 +855,7 @@ ag_chart_create_svg(AgChart *chart, GError **err)
g_free(css_path); g_free(css_path);
g_free(css_uri); g_free(css_uri);
g_object_unref(css_file); g_object_unref(css_file);
g_object_unref(xslt_file);
g_free(xslt); g_free(xslt);
xmlFreeDoc(doc); xmlFreeDoc(doc);
@ -866,6 +868,7 @@ ag_chart_create_svg(AgChart *chart, GError **err)
g_free(css_path); g_free(css_path);
g_free(xslt); g_free(xslt);
g_free(css_uri); g_free(css_uri);
g_object_unref(xslt_file);
g_object_unref(css_file); g_object_unref(css_file);
xmlFreeDoc(xslt_doc); xmlFreeDoc(xslt_doc);
xmlFreeDoc(doc); xmlFreeDoc(doc);
@ -887,6 +890,7 @@ ag_chart_create_svg(AgChart *chart, GError **err)
uselocale(current_locale); uselocale(current_locale);
g_free(stylesheet_path); g_free(stylesheet_path);
g_free(css_path); g_free(css_path);
g_object_unref(xslt_file);
g_object_unref(css_file); g_object_unref(css_file);
g_free(params); g_free(params);
xsltFreeStylesheet(xslt_proc); xsltFreeStylesheet(xslt_proc);